help-serveez
[Top][All Lists]
Advanced

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

Re: [help-serveez] Thread safety


From: Andreas Rottmann
Subject: Re: [help-serveez] Thread safety
Date: 06 Dec 2002 16:21:14 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

stefan <address@hidden> writes:

> On 6 Dec 2002, Andreas Rottmann wrote:
> 
> > Hi!
> 
> Hello!
> 
> First of all:  Serveez is not and will never be thread-safe. Period.
> 
[snip]
> 
> However it should be possible to make some API functions of Serveez
> thread-safe.  
>
I read this (roughly) as 'the serveez main loop will always run
single-threaded, and associated functions thus will not be thread
safe'. I know this and am in no way proposing a change here :-)

> 'svz_log' looks like a reasonable candidate.  The easiest
> way to implement this would be to define a static (access lock) variable
> inside svz_log.  
>
Yes.

> The problem is: Serveez does not use any thread API.
>
> Therefore we need a sleep()'y loop (waiting for the (access) variable) or
> something.  Any better idea?
>
This would be horrible IMO. I'd simply make it possible to compile
serveez against POSIX threads (configure option), and then use a
mutex.

> > c) This is a bit hairy. svz_config is *not* static. IMO, It would be
> >    wise to make it static and use accessor functions. Then it could be
> >    locked.
> >
> > I'd be glad to provide a patch that makes svz_log thread-safe (or
> > mostly so ;-)), but before I want to hear comments on c), since making
> > svz_config static would result in API breakage.
> 
> Actually I forgot why svz_config is not static...
> 
Is it used from `outside' of serveez/libserveez?

> Bottom line: How do we implement a synchronization mechanism?
> 
See above. If POSIX threads are available on the system, use them;
else just be not thread-safe.

Reagards, Andy
-- 
Andreas Rottmann         | address@hidden        | address@hidden | 
address@hidden
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62




reply via email to

[Prev in Thread] Current Thread [Next in Thread]