LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Threads inside shared library (https://www.linuxquestions.org/questions/programming-9/threads-inside-shared-library-419323/)

arunka 02-25-2006 12:10 AM

Threads inside shared library
 
hi all..
can we create threads inside a shared library??

Thanks in advance
Arun KA

paulsm4 02-25-2006 12:54 AM

Yes, definitely.

Unix/Linux .so shared libraries don't have a DllMain() or any other notion of "state" - so there's no problem whatsoever.

Windows .dll shared libraries have some issues, but generally threading isn't any more or less an issue with .dll-based code than any other code, even on Windows.

Here are a couple of worthwhile links on Linux shared libraries:
http://yolinux.com/TUTORIALS/Library...ndDynamic.html
http://www.tldp.org/HOWTO/Program-Library-HOWTO/

'Hope that helps .. PSM

PS:
"Creating threads inside a shared library" probably isn't the best way to think about it. Basically, "it's just code" - you have exactly the same concurrency and data protection issues regardless of whether the linkage is from a .o object, a .a static library, or dynamically loaded at runtime from a .so. This is particularly true for Linux, and it's "mostly true" for Windows.


All times are GMT -5. The time now is 09:22 PM.