Messages in this thread | | | Date | Fri, 19 Nov 1999 21:31:54 +0100 | From | Manfred Spraul <> | Subject | Re: [Patch] shm bug introduced with pagecache in 2.3.11 |
| |
"Benjamin C.R. LaHaise" wrote: > > On Fri, 19 Nov 1999, Linus Torvalds wrote: > > > Is anybody willing to take a stab at creating a read-write semaphore? > > Sure. Does the following sound? > > void down_read(struct rw_semaphore *sem); > void down_write(struct rw_semaphore *sem); > void up_read(struct rw_semaphore *sem); > void up_write(struct rw_semaphore *sem); > > Looking at existing semaphores and rwlocks, it looks like a quick and > painless beast to create. > There is a subtle problem: a rw semaphore is no real semaphore, it will not support counts [at least if you base them on the rwlock asm code]: semaphores allow a call to up() before the corresponding down(), eg vfork() could do that [on SMP with an extremely long interrupt on the line with the fork_out-label ;)
I would prefer if you use completely different function names to avoid any confusion. eg acquire_shared() acquire_exclusive() release_shared() release_exclusive()
-- Manfred
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |