W3C home > Mailing lists > Public > www-lib@w3.org > October to December 1997

Re: Has anybody used pthreads with w3-lib

From: Bjoern Voigt <bjoern@cs.tu-berlin.de>
Date: Thu, 20 Nov 1997 15:07:34 +0100 (MET)
To: Krishna Vedati <kvedati@Rational.Com>
cc: www-lib@w3.org
Message-ID: <Pine.SOL.3.95.971120144645.22606A-100000@centime.cs.tu-berlin.de>

> 	Is w3lib thread safe?

You have to specify the --enable-reentrant and (for
some compilers) the -mt flags. So you get the LibWWW to use the right
system calls.  

But, I could NOT confirm that the LibWWW (test version 5.0a) is
MT-safe. If you look at the code, you will find some unsafe functions.
For instance, I believe that to processing of lists is not MT-safe.
You will get problems, if you use some LibWWW functions parallel from
some application threads. 

There are two solutions:
  
  1) Forbit all parallel calls of LibWWW functions. This can be done
     with mutexes (for instance). So you can not request WWW documents
     parallel from some application threads.

  2) Forbit parallel calls of LibWWW functions and but allow parallel
     calls on some points. I allowed parallel calls around the select
     system call within in event loop. Because the program often waits
     within the select call, other threads have a chance to call
     LibWWW functions. This solution is expensive.

Bye, Björn
Received on Thursday, 20 November 1997 09:14:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:27 GMT