Context initialization and cleanup

The routines cs_ctx_alloc, cs_ctx_drop, ct_init, and ct_exit are thread-unsafe and must be serialized as follows:

You need not worry about this issue if your program allocates and initializes all necessary CS_CONTEXT structures in single-threaded initialization code and performs all context-level cleanup operations in single-threaded cleanup code. An alternative strategy limits the use of a given context structure to a single thread to eliminate the need for serialization.