dazuko-help
[Top][All Lists]
Advanced

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

Re: [Dazuko-help] dazuko and threads


From: John Ogness
Subject: Re: [Dazuko-help] dazuko and threads
Date: Sun, 20 Jul 2003 10:57:23 +0200
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20030708

Hi,

The only function that requires surround mutexes is:

dazukoRegister()

All other functions do not require a mutex around them. However, the thread support is not very good. You will have problems if one of your threads calls dazukoUnregister(). This will close your only connection to Dazuko, thus leaving the other threads stranded, yet still registered. This is very bad.

Rather than calling dazukoUnregister(), you should call:

close(_DAZUKO_DEVICE);

for each thread. This should work for multi-threaded applications. Until I can develop a better solution, this will have to do. I will most likely either add a define for thread support or implement it correctly using other functions, for example:

dazukoRegister_r()

I would rather make the existing functions truly thread-safe, however the problem is that this significanltly changes the interface. This would break applications that are already based off the old interface. :(

I will keep you posted. However, please try the new 1.2.2-pre2 version using the close() function mentioned above rather than dazukoUnregister() and let me know if that works ok for you.

John Ogness


John Ogness wrote:
Hi,

Thank you for bringing this to my attention. A new pre-release is available:

http://savannah.gnu.org/download/dazuko/dazuko-1.2.2-pre2.tar.gz

This version includes support for threads. However, the functions are not thread-safe, so you should add your own locks around the dazukoXXX function calls.

John Ogness


Frantisek Mensik wrote:

Hi,

cause:
dazkoio.c file, lines 40 and 41.
_DAZUKO_DEVICE is set to value 7 after first call of dazukoRegister function from the first thread. So call of the same function ends with 'return -1;' in the second thread.

- Frantisek Mensik


John Ogness wrote:

Hi,

What kinds of errors were you getting? Dazuko identifies registered
processes by PID. Since each thread in Linux has its own PID, it must
register separately. Threads of a registered process will not be
recognized as registered.

If you compile Dazuko using with the -DDEBUG flag, then Dazuko will
output more information about what is going on. It might help to make
things clearer.

John Ogness


Frantisek Mensik wrote:

Hi,
I've tryed it in a test application and I couldn't register in second
and third threads. Wouldn't it be better to register only once in a main thread, than create threads (pthread_create) which would get access from
included files.

-Frantisek Mensik


John Ogness wrote:


Hi,

Yes, each thread may register with Dazuko. However, each thread is then
also responsible for handling file access control.

John Ogness


Frantisek Mensik wrote:


Hi,
if I have an application with more threads, is it possible to register
dazuko from each thread?
Thanks for an answer,
-F.M.





reply via email to

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