Re: Help: multithreaded GNOME app
- From: Jeff Garzik <jgarzik pobox com>
- To: Jason Tackaberry <tack dok org>
- cc: Sri Ramkrishna <sri aracnet com>, gnome-list gnome org
- Subject: Re: Help: multithreaded GNOME app
- Date: Mon, 1 Feb 1999 17:07:41 -0500 (EST)
On Mon, 1 Feb 1999, Jason Tackaberry wrote:
> > ?? man pipe. It allocates two descriptors for you, one read, and one
> > write. If you want bi-directional communication, create two pipes.
>
> Quite right. Forgive my stupidity -- I thought pipe linked together two
> already-allocated file descriptors.
>
> > For speed, you only want to send read or write a single byte to the
> > pipe. This is sufficient to wake up the process. Do not use the pipe
> > to pass data larger than sizeof(void*) to the main process, doing so is
> > very wasteful.
>
> One byte is all I'd use, yeah. Is there some low-level rationale behind why
> passing data specifically larger than sizeof(void *) is wasteful? Something
> to do with the memory bus?
Since you are using threads, anything passed via a pipe from one thread
to another is useless data copying, since the threads share the same
dataspace. Anything less than sizeof(void*) can be excused, IMHO,
because it is often easier to pass a simple pointer or integer directly
rather than signal, via the pipe, that said pointer/int needs to read.
Jeff
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]