http://www.perlmonks.org?node_id=1202807


in reply to Multi-thread friendly object life-time handling for XS modules

Um, store all libssh pointers/objects in a global array or hash, and only cleanup from perl swub destroy when nothing points to it, or in end block for global cleanup

or look to see how wxperl does it.

https://metacpan.org/pod/distribution/Wx/lib/Wx/Thread.pod

so make condition that main thread loads module. Then keep all real pointers alive in main...

sorry im afk and my memory is weak

wait, hiw does dbi do it? Oh righg it just croaks when user tries to share, sounds smart :)https://metacpan.org/pod/DBI#Threads-and-Thread-Safety