Boost logo

Boost :

Subject: Re: [boost] Announcing LEAF, a new error handling library suitable for low latency applications
From: Gavin Lambert (boost_at_[hidden])
Date: 2018-11-15 01:19:40


On 15/11/2018 12:29, Emil Dotchevski wrote:
> It uses thread_local raw pointers, one per error type. This is needed in
> order to decouple result<T> from the static type of error objects being
> propagated, which I consider critical, see
> https://zajo.github.io/leaf/#rationale.
>
>> Is it compatible with coroutines or fibers or other non-thread-based stacks?
>
> Good question. I'm not sure, but I'm interested to know what are the issues.

In general AFAIK, any use of thread-local storage is entirely
incompatible with coroutines or fibers. (Unless the mechanisms for both
cooperate with each other, which is theoretically possible but I'm not
aware of it occurring in the wild.)

(If you can guarantee that a given set of coroutines or fibers always
executes within a single thread, then accessing thread-local objects
created *outside* the coroutines is "safe" (they all access the same
object, but non-concurrently; it can still lead to surprises if the
object is mutable, however), but less so those created inside. Either
way it's a little confusing.)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk