A shared lib will act as if every process using it has its own independent copy of everything in the shared lib.
Any part of the shared lib for which independent copies would be required for correct behavior will actually have independent copies.
Only parts for which the behavior would be the same for shared vs. copied will actually be shared.
So you don't need to add any critical sections etc. to manage such sharing.
BUT, if multiple processes are doing file I/O to the same files, you do need to manage that. That fact is completely independent of whether or not that file I/O occurs in a shared lib (so the code to do the file I/O is shared).
So your situation might require some synchronization (critical sections or other methods) to manage the file access, even though it doesn't need any for the use of the .so.
Last edited by johnsfine; 09-27-2010 at 10:04 AM.
|