Subversion Repositories HelenOS-historic

Rev

Rev 1229 | Rev 1502 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1229 Rev 1248
Line 24... Line 24...
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
-
 
29
/**
-
 
30
 * @file    rwlock.c
29
/** Reader/Writer locks
31
 * @brief   Reader/Writer locks.
30
 *
32
 *
31
 * A reader/writer lock can be held by multiple readers at a time.
33
 * A reader/writer lock can be held by multiple readers at a time.
32
 * Or it can be exclusively held by a sole writer at a time.
34
 * Or it can be exclusively held by a sole writer at a time.
33
 */
35
 *
34
 
-
 
35
/*
-
 
36
 * These locks are not recursive.
36
 * These locks are not recursive.
-
 
37
 * Because technique called direct hand-off is used, neither readers
37
 * Neither readers nor writers will suffer starvation.
38
 * nor writers will suffer starvation.
38
 *
39
 *
39
 * If there is a writer followed by a reader waiting for the rwlock
40
 * If there is a writer followed by a reader waiting for the rwlock
40
 * and the writer times out, all leading readers are automatically woken up
41
 * and the writer times out, all leading readers are automatically woken up
41
 * and allowed in.
42
 * and allowed in.
42
 */
43
 */
Line 143... Line 144...
143
 * @param rwl Reader/Writer lock.
144
 * @param rwl Reader/Writer lock.
144
 * @param usec Timeout in microseconds.
145
 * @param usec Timeout in microseconds.
145
 * @param trylock Switches between blocking and non-blocking mode.
146
 * @param trylock Switches between blocking and non-blocking mode.
146
 *
147
 *
147
 * For exact description of possible combinations of
148
 * For exact description of possible combinations of
148
 * @usec and @trylock, see comment for waitq_sleep_timeout().
149
 * usec and trylock, see comment for waitq_sleep_timeout().
149
 *
150
 *
150
 * @return See comment for waitq_sleep_timeout().
151
 * @return See comment for waitq_sleep_timeout().
151
 */
152
 */
152
int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock)
153
int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock)
153
{
154
{