CTryCatch icon indicating copy to clipboard operation
CTryCatch copied to clipboard

Thread-safety tests

Open Jamesits opened this issue 9 years ago • 3 comments

Jamesits avatar Jan 03 '16 15:01 Jamesits

Can be done easily :

  • lock a mutex whenever you use a global variable, unlock it when you are done

Klevh avatar Jan 25 '18 08:01 Klevh

@Klevh I guess this needs some threading library... I wanted it to be plain C implementation.

Jamesits avatar Feb 02 '18 08:02 Jamesits

You can also put all globals in a single C source file (not header), as static thread_local, and write basic functions to access them (it just works the same as encapsulation in C++, for example), so :

  1. Coupling is (a bit) reduced
  2. Each thread has its own exceptions

brvtalcake avatar May 08 '23 20:05 brvtalcake