Re: you are my only friend
- From: Sebastian Wilhelmi <wilhelmi ira uka de>
- To: John Cupitt <john cupitt ng-london org uk>
- Cc: Monserrat Seisdedos Nuñez <mseisdedos cirsa com>, Gtk Development List <gtk-devel-list gnome org>
- Subject: Re: you are my only friend
- Date: Mon, 26 Feb 2001 17:09:34 +0100
Hi,
> Monserrat Seisdedos Nuñez wrote:
> > are The glib threads valid for processes??
> >
> > I have read that the kernel needs to have defined
> > _POXIS_THREAD_PROCESS_SHARED
> > How can i see if my kernel has it ????
>
> Sorry Monserrat, I think you're right, glib has no shared memory stuff,
> and you can't init a mutex at a particular address.
>
> Does anyone have a better answer?
Linux for example does not support PTHREAD_PROCESS_SHARED for mutexes.
Besides, as GLib does not support shared memory, there is not much sense
supporting shared memory mutexes.
The solution seems to be to communicate the owner information (who is allowed
to access the shared mem) over a unix socket. That IIRC the way X11 handles
that problem. I.e. the client writes the data into the shared mem and after
that send a message to the server over a unix socket. the server then reads
the data from the shared mem and might write something back as well. Than it
sends a message back over the unix socket telling the client, that it is ready
and client is now free to do with the shared mem, whatever he wants.
The problem is, that in mutexes there are lists to sleeping threads, that
should be woken up, whenever the mutex is released. These lists are allocated
in the process private memory (simply because that's what malloc returns).
Such a list would be quite hard to implement for two processes, even if you
could in theory initialize the mutex in the shared mem.
Bye,
Sebastian
--
Sebastian Wilhelmi
mailto:wilhelmi ira uka de
http://goethe.ira.uka.de/~wilhelmi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]