farsightsec / nmsg

network message encapsulation library
Apache License 2.0
30 stars 8 forks source link

Use stdatomic functions for thread-safe operations. #130

Closed skempdt closed 8 months ago

skempdt commented 11 months ago

Use stdatomic functions instead of an explicit mutex to protect operations.

edmonds commented 8 months ago

Could probably use the atomic_*_explicit() variants that take a memory_order parameter and set the memory order to relaxed. Otherwise the default memory order is sequential consistency which is probably too strong for counters and flags.