saprykin / plibsys

Highly portable C system library: threads and synchronization primitives, sockets (TCP, UDP, SCTP), IPv4 and IPv6, IPC, hash functions (MD5, SHA-1, SHA-2, SHA-3, GOST), binary trees (RB, AVL) and more. Native code performance.
MIT License
672 stars 74 forks source link

Check state of plibsys library initalization #93

Open ghost opened 3 years ago

ghost commented 3 years ago

While might be a weird way to use plibsys, i seem to have a library that uses plibsys, along with the actual executable using the library... so in a weird way is there some way to check if plibsys has been shutdown/initialized already, and account our program around that... seeing the code, it doesnt seem entirely impossible to say the current state of the library. doing this will allow my to shutdown my external library using plibsys, check if it shut it down (which it most likely has) and initializing it if i still have a need for plibsys still, but no need for my external library which also uses plibsys

saprykin commented 11 months ago

It is safe to call init/shutdown multiple times, as the library checks internally the state. Wouldn't it work this way?