faragon / libsrt

libsrt is a C library for writing fast and safe C code, faster. It provides string, vector, bit set, set, map, hash set, and hash map handling. Suitable for soft and hard real-time. Allows both heap and stack allocation. *BETA* (API still can change: suggestions are welcome)
https://faragon.github.io/libsrt.html
BSD 3-Clause "New" or "Revised" License
548 stars 48 forks source link

Is libsrt thread-safe? #34

Closed seirios closed 1 year ago

seirios commented 2 years ago

Hello! I'm thinking of adopting this library for my projects, but I'm worried about thread safety. According to Paul Hsieh's String Library Comparisons table, libsrt has Thread Safety: No. Could you please explain what parts of the library are not thread-safe? Thanks!

niuggg commented 1 year ago

good

faragon commented 1 year ago

@seirios Hi, Paul is right, libsrt is intentionally not thread safe: It is "thread safe" for concurrent read-only operations, e.g. initialization, fill the data, and use the data from N threads, but not for write or read+write concurrent operation. E.g. it is as "thread safe" as the equivalent C++ STL containers, which are also not thread safe for concurrent read+write or write+write.