While state threads makes it easy to write high performance programs, to take advantage of modern CPUs with many cores, you are forced to fork processes and used shared memory to share state. It would be good if state thread was made pthread safe so that state-threads "state" could be managed on a per-pthread basis.
This change should be fairly simple entailing the following:
1) Encapsulate of st statics into a single struct, call it sts
2) Change all the base functions to pass sts as param1 and thus refer to their state via the param1 pointer
3) Convert existing public functions into wrapper functions that refer to a per-process sts
4) Expose new public functions with sts as the first param