@@ -129,6 +129,26 @@ linked list, which is what makes the library so efficient. If the =chunk_sz=
129129parameter of =pool_new= is smaller than =sizeof(void*)=, the function will return
130130=NULL=.
131131
132+ * Thread safety
133+
134+ The library can be optionally compiled with multithreading support, allowing the
135+ user to perform operations on the pool (allocations, frees, expansions) from
136+ different threads. To enable thread safety, compile the library with
137+ =LIBPOOL_THREAD_SAFE= defined.
138+
139+ Furthermore, if =LIBPOOL_NO_STDLIB= is defined, the user is responsible for
140+ assigning 4 function pointers:
141+
142+ - =pool_ext_mutex_new=, which should return a pointer to a unspecified mutex type,
143+ which will be used by the other multithreading functions from within each
144+ pool.
145+ - =pool_ext_mutex_destroy=, which should destroy (deinitialize, free, etc.) a
146+ mutex pointer, previously allocated through =pool_ext_mutex_new=.
147+ - =pool_ext_mutex_lock=, which should receive a mutex pointer and lock it to the
148+ current thread.
149+ - =pool_ext_mutex_unlock=, which should receive a previously-locked mutex pointer
150+ and unlock it, so that other threads can lock it.
151+
132152* Building the example
133153
134154Clone the repository and build the project using =make=.
0 commit comments