I am writing a shared library in C. I know that C functions are not thread safe.
My library routines look like
struct lib_handle {
....
};
int lib_init(lib_handle **handle);
int lib_process(lib_handle *handle);
....
....
Each method takes a pointer to an object lib_handle. All state is stored inside this structure. Global variables are not used.
I assume that if each thread creates its own instances lib_handle, several threads can use library functions. Since each thread has its own descriptor, each of them should work.
I have not yet confirmed this assumption. I am wondering what you guys think of this project, and can you designate my library as thread safe, given that each thread has its own descriptors?
Any help would be great!