My developing function consists of shared libraries that is thread safe.
This shared library can be called by both nonthreaded programs and multithread 
programs. I don't want to provide two shared libraries for nonthreaded programs 
and for multithread programs. For this reason, I want to provide only shared 
libraries compiled with the -D_POSIX_C_SOURCE flag and linked with 
libpthread.so for multithread programs.
However, there are the following descriptions on Solaris' Multithreaded 
Programming Guide.

Do not link a nonthreaded program with -lthread or -lpthread. Doing so 
establishes multithreading mechanisms at link time that are initiated at 
runtime. These slow down a single-threaded application, waste system resources, 
and produce misleading results when you debug your code.

When a nonthreaded program runs on before Solaris 9, four more threads run as 
follows.
(dbx) lwps
*>[EMAIL PROTECTED] breakpoint       in main()
  [EMAIL PROTECTED] running          in _signotifywait()
  [EMAIL PROTECTED] running          in ___lwp_mutex_lock()
  [EMAIL PROTECTED] running          in __lwp_sema_wait()
o [EMAIL PROTECTED] syscall return 159 in _lwp_s

What problems do I have by providing only shared libraries compiled with the 
-D_POSIX_C_SOURCE flag and linked with libpthread.so for multithread programs?
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to