help-serveez
[Top][All Lists]
Advanced

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

Re: [help-serveez] Thread safety


From: stefan
Subject: Re: [help-serveez] Thread safety
Date: Sun, 8 Dec 2002 15:50:51 +0100 (CET)

On 6 Dec 2002, Andreas Rottmann wrote:

> > 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.

Personally I do hestitate putting (POSIX) threads into the Serveez API.
But if I ever get convince to do so I propose this:

 * create 'threads.h' and 'threads.c' into libserveez
 * use system dependent #ifdef #endif's
 * supply a system independent interface like:
        - svz_mutex_create (char *name)
        - svz_mutex_lock (char *name)
        - svz_mutex_unlock (char *name)
        - svz_mutex_destroy (char *name)
   The mutices in serveez should be referenced by a unique name and should
   be managed in a 'svz_hash_t'.
 * if no thread/mutex API is available on the system the functions should
   be empty and thread-safety goes to waste
 * for GNU/Linux I proprose the pthread API

> > Actually I forgot why svz_config is not static...
> >
> Is it used from `outside' of serveez/libserveez?

The 'svz_config' is not static because it is used inside libserveez across
object (.o) boundaries.  It is a unique global symbol.

Cheers,
        address@hidden




reply via email to

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