Bruno Haible <br...@clisp.org> writes: > If you think that using the POSIX API literally is important, how about > changing the gnulib threading modules to adopt the POSIX API (with > limitations where necessary)?
Yes, that would be nice. We want the source code to look like POSIX. Also, part of the idea, I expect, is to use only the system's POSIX-compatible pthread support, or to use no threads at all, and not to mess with non-POSIX-compatible threading, in order to simplify porting hassles. (This is how I interpreted Jim's remarks.) We don't need to worry about OSF/1, either, as it's obsolete. If the gnulib threading module made it easy for a package to run in simplified pthread-or-nothing mode, that would be handy. Perhaps I could try to draft something along those lines? One worry I have is that suppose part of a package wanted to use the pthread module, and another part wanted to use the thread module; we'd want that to work too, I expect. This would suggest a rather thin interface from pthread to thread, with a lot of stuff turned off if nobody uses thread directly. (I'm handwaving a bit here....) > - pthread.m4 assumes that in order to use threads, it is only necessary to > add some library at link time. But this is not enough: > - On OSF/1 and Solaris, -D_REENTRANT needs to be added to CPPFLAGS. > - On AIX and FreeBSD, -D_THREAD_SAFE needs to be added to CPPFLAGS. > See m4/threadlib.m4 for details. Thanks for mentioning that; it needs to be fixed one way or another.