Previous: Signal Handling, Up: Preparation

2.8 Multi Threading

The GPGME library is not entirely thread-safe, but it can still be used in a multi-threaded environment if some care is taken. If the following requirements are met, there should be no race conditions to worry about:


[1] At least this is true for POSIX threads, as pthread_create is a function that synchronizes memory with respects to other threads. There are many functions which have this property, a complete list can be found in POSIX, IEEE Std 1003.1-2003, Base Definitions, Issue 6, in the definition of the term “Memory Synchronization”. For other thread packages other, more relaxed or more strict rules may apply.