lkml.org 
[lkml]   [2000]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: acquiring resources shared or exclusive
Date
Jerry Kelley writes:
> I have a rudimentary question as I'm new to the Linux kernel. Is there a
> resource that can be acquired shared so that multiple threads can read data
> from a protected region and not block each other? It seems that the
> semaphore in the Linux kernel is only exclusively acquirable. I need to be
> able to share read access from several threads to some global structures and
> don't want them to block.
>
> I do want blocking whenever I have to modify the structures though. Thus I'm
> looking for a way to perform synchronization for reads (shared) and writes
> (exclusively) in the kernel. I assume it can be done it's just that I'm not
> sure how to do it yet. This is probably a very easy question.

There are read/write locks available in the kernel. Look in
include/linux/spinlock.h and include/linux/brlock.h.

Cheers, Andreas
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.031 / U:1.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site