Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 1997 08:55:23 +0900 (JST)
From:      Michael Hancock <michaelh@cet.co.jp>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   mset, mclear, msleep, mwakeup (was Re: Using rfork() / threads)
Message-ID:  <Pine.SV4.3.95.970204084303.13628A-100000@parkplace.cet.co.jp>
In-Reply-To: <Pine.SUN.3.91.970203092205.3325F-100000@terra>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 3 Feb 1997, Ron G. Minnich wrote:

> On Sat, 1 Feb 1997, Michael Hancock wrote:
> > The Vahalia book mentions shared memory locks for 4.4BSD that worked
> > essentially the same way.  They were named mset, mwait, or something like
> > that.
> 
> yeah, but recall that I did this stuff 9/94. mset etc. were not around 
> then, and appear to still not be. 
> 
> > Fastlock sounds cool, but shared memory locks are supposed to be fast. 
> It's a bit more complex than shared memory locks. The problem is making
> shared memory locks between heavyweight processes that are efficient and 
> in particular never do a system call unless needed. 
> 
> > I prefer the mxxx conventions to categorize it with the
> > mmap calls. 
> 
> works for me. 
> 

This is how Vahalia describes it.  On the newsgroups John Dyson said he
remembers seeing a document in 4.4Lite somewhere describing it. 

Can you work with these interfaces?  Maybe you can submit them to John for
review or colloborate with him on rewriting it.

mset() and mclear() must be user level functions on architectures that
have atomic test-and-set.  You don't do a system call unless necessary.

value = mset(sem, wait);

	sem is a pointer to a semaphore value
	wait is a boolean that is set to true if you want to block
	value is zero if the semaphore has been acquired

mclear(sem);

If you want to block and unblock use the following:

msleep(sem);

mwakeup(sem);

Wakes up at least one process blocked on this semaphore or does nothing if
there are no blocked semaphores.

Regards,


Mike Hancock




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SV4.3.95.970204084303.13628A-100000>