Re: deciding threading support at compile time

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

 



Hi Christoph,

You asked...
How can a library writer reliably decide in a header file whether the program is to support multithreading?


The answer appears to be:

Document that some define is required when used in conjunction with your header file that enables multithreading facilities, such as mutex protection, necessary for safe multithreaded operation of your library.

For instance, maybe something like -DBOOST_POSIX_THREADS would be appropriate.

Also of interest is another approach, that taken by Doug Schmidt's ACE (http://www.cs.wustl.edu/~schmidt/ACE.html). Therein, he punted* by allowing the POLICY level decision of mutex protection to be at the discretion of the library user, by making the mutex a template object that could (possibly) be a null_mutex.

HTH,
--Eljay

* Or if you think Doug's idea was a good one (as I do), replace "punted" with "was inspired".


[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