[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sigsegv_register and async-safety
From: |
Marc Nieper-Wißkirchen |
Subject: |
Re: sigsegv_register and async-safety |
Date: |
Mon, 1 Jun 2020 19:23:59 +0200 |
Am Mo., 1. Juni 2020 um 19:17 Uhr schrieb Bruno Haible <bruno@clisp.org>:
> I don't see a good easy fix either. One would need an interrupt-safe balanced
> binary tree.
At the moment, I use memory fences and a spinlock based on the atomic
flag exported by <stdatomic.h>. (That's one reason why I have been
looking for a portable Gnulib version of atomic primitives.)
> An easy fix would be that 'sigsegv_register' and 'sigsegv_unregister' clone
> the entire binary tree first, then make an insert or delete in it, and finally
> replace the root of the binary tree atomically. But then the complexity
> of building a binary tree with N elements would be O(N² log N), not O(N log
> N).
Wouldn't a functional binary tree help here? ([1])
--
[1] http://matt.might.net/papers/germane2014deletion.pdf