kern_rwlock.c (154973) | kern_rwlock.c (155012) |
---|---|
1/*- 2 * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30/* 31 * Machine independent bits of reader/writer lock implementation. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30/* 31 * Machine independent bits of reader/writer lock implementation. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/kern/kern_rwlock.c 154973 2006-01-29 02:35:22Z mlaier $"); | 35__FBSDID("$FreeBSD: head/sys/kern/kern_rwlock.c 155012 2006-01-29 20:48:25Z scottl $"); |
36 37#include "opt_ddb.h" 38 39#include <sys/param.h> 40#include <sys/ktr.h> 41#include <sys/lock.h> 42#include <sys/mutex.h> 43#include <sys/proc.h> --- 466 unchanged lines hidden (view full) --- 510#ifdef WITNESS 511 witness_assert(&rw->rw_object, what, file, line); 512#else 513 /* 514 * If some other thread has a write lock or we have one 515 * and are asserting a read lock, fail. Also, if no one 516 * has a lock at all, fail. 517 */ | 36 37#include "opt_ddb.h" 38 39#include <sys/param.h> 40#include <sys/ktr.h> 41#include <sys/lock.h> 42#include <sys/mutex.h> 43#include <sys/proc.h> --- 466 unchanged lines hidden (view full) --- 510#ifdef WITNESS 511 witness_assert(&rw->rw_object, what, file, line); 512#else 513 /* 514 * If some other thread has a write lock or we have one 515 * and are asserting a read lock, fail. Also, if no one 516 * has a lock at all, fail. 517 */ |
518 if (rw->rw_lock == RW_UNLOCKED || 519 !(rw->rw_lock & RW_LOCK_READ) && (what == RW_RLOCKED || 520 RW_OWNER(rw) != (uintptr_t)curthread)) | 518 if ((rw->rw_lock == RW_UNLOCKED || 519 !(rw->rw_lock & RW_LOCK_READ)) && (what == RA_RLOCKED || 520 (rw_owner(rw) != curthread))) |
521 panic("Lock %s not %slocked @ %s:%d\n", | 521 panic("Lock %s not %slocked @ %s:%d\n", |
522 rw->rw_object.lo_name, (what == RW_RLOCKED) ? | 522 rw->rw_object.lo_name, (what == RA_RLOCKED) ? |
523 "read " : "", file, line); 524#endif 525 break; 526 case RA_WLOCKED: 527 if (rw_owner(rw) != curthread) 528 panic("Lock %s not exclusively locked @ %s:%d\n", 529 rw->rw_object.lo_name, file, line); 530 break; --- 58 unchanged lines hidden --- | 523 "read " : "", file, line); 524#endif 525 break; 526 case RA_WLOCKED: 527 if (rw_owner(rw) != curthread) 528 panic("Lock %s not exclusively locked @ %s:%d\n", 529 rw->rw_object.lo_name, file, line); 530 break; --- 58 unchanged lines hidden --- |