Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is Bstrlib thread safe?

bstrlib safe thread
0
Posted

Is Bstrlib thread safe?

0

A. The thread safety in Bstrlib is comparable to that of a linked list or any other self-contained ADT (abstract data type) rather than that of a system-defined atomic data-type such as sig_atomic_t. I.e., reading and writing to the same bstring at the same time leads to undefined results. However, there is no restriction whatsoever from manipulation or reading two different bstrings. Also clearly there can be any number of readers for a single bstring. In particular, Bstrlib has no static/globally written state, so using it won’t lead to hidden or unavoidable race conditions. Every function in Bstrlib is also re-entrant, and can be called even by dynamically linked code provided they have a proper context for calling malloc/realloc/free. To support shared read/write semantics, it is sufficient and recommended that exclusion/critical-sections be handled at higher layers in your code by just making sure that the same bstring is not being modified by more than one thread at once (this wi

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.