Re: Writing a thread-safe library without pulling in pthreads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Ian Lance Taylor:

>> But I'm hosed if a library is loaded later (via dlopen) that pulls in
>> threads, right?  This looks unsupported, so it should be okay if I can't
>> deal with this situation.
>
> Yes, you are probably hosed in that case.  Offhand I can't think of
> any reasonable way to make that work correctly, given that the dlopen
> might occur when a lock would nominally be held.

Hmm, but that could only happen if dlopen is called from a signal
handler.  I suppose calling an signal-handler-safe function cannot
trigger arbitrary DSO loading (otherwise, this would be a bug).

I don't plan to hold the lock during callbacks or returns to the caller,
so I should be fine.  I just want to protect the state of a PRNG.

Sorry for posting to the wrong mailing list, BTW.  I intended to post to
libc-help. 8-)

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux