Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Nov 1996 21:38:53 +0600
From:      Tim Pierce <twpierce@bio-3.bsd.uchicago.edu>
To:        scrappy@ki.net
Cc:        hackers@FreeBSD.ORG
Subject:   Re: semaphores/shared memory
Message-ID:  <9611110338.AA13774@bio-5.bsd.uchicago.edu>
In-Reply-To: <9611100512.AA13579@bio-5.bsd.uchicago.edu> (message from Tim Pierce on Sat, 9 Nov 1996 23:12:27 %2B0600)

next in thread | previous in thread | raw e-mail | index | archive | help
I wrote:

> > 	essentially, I want the server to write a line of data to 
> > shared memory, then signal all the clients at once that the data is
> > there, so that they all pick up the data...
> 
> It sounds like this ought to be easy if you simply have each
> client wait on the semaphore, and then have the server increment
> the semaphore by a suitably high number (e.g. MAXINT) in order to
> ensure that they all are freed at once.

No, sorry, even this shouldn't be necessary.  Have the server
create the semaphore and increment its value to 1.  Then have each
client wait until the semaphore becomes 0.  When the data has been
written to shared memory, have the server decrement the semaphore
to zero, which will unblock all of the clients.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9611110338.AA13774>