I did a first try for thread support using pthread on KC3 and it mostly works because the facts database (triple store) and its cursors (iterators) are already locked using pthread rwlock and mutex.
To make this possible many pointers were added to s_env
to make copying the environment possible while sharing the pointers on the heap. This was an easy refactor as libkc3 has this nice usage of providing *_init functions as well as *_new functions for heap allocation and appropriate error handling.
Now the main problem is standard output buffers which are shared between environments but are not locked. For now. To be continued...