Coding thread-safe callback routines

If a callback function can be called from multiple threads, then the callback must be thread-safe. Generally, callbacks are called from the thread that provoked the callback event, but some callbacks can be invoked by an internal Client-Library worker thread and execute in the context of the worker thread. Table 2-26 summarizes which thread invokes each callback type. Callbacks for use in a multithreaded environment should be coded according to the following rules: