lock.c (174112) | lock.c (175864) |
---|---|
1/*- 2 * Copyright (c) 2001, 2003 Daniel Eischen <deischen@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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2001, 2003 Daniel Eischen <deischen@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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/lib/libkse/sys/lock.c 174112 2007-11-30 17:20:29Z deischen $ | 26 * $FreeBSD: head/lib/libkse/sys/lock.c 175864 2008-01-31 19:38:26Z deischen $ |
27 */ 28 29#include <sys/types.h> 30#include <machine/atomic.h> 31#include <assert.h> 32#include <stdlib.h> 33 34#include "atomic_ops.h" --- 78 unchanged lines hidden (view full) --- 113 return (0); 114} 115 116int 117_lockuser_reinit(struct lockuser *lu, void *priv) 118{ 119 if (lu == NULL) 120 return (-1); | 27 */ 28 29#include <sys/types.h> 30#include <machine/atomic.h> 31#include <assert.h> 32#include <stdlib.h> 33 34#include "atomic_ops.h" --- 78 unchanged lines hidden (view full) --- 113 return (0); 114} 115 116int 117_lockuser_reinit(struct lockuser *lu, void *priv) 118{ 119 if (lu == NULL) 120 return (-1); |
121 /* 122 * All lockusers keep their watch request and drop their 123 * own (lu_myreq) request. Their own request is either 124 * some other lockuser's watch request or is the head of 125 * the lock. 126 */ 127 lu->lu_myreq = lu->lu_watchreq; | 121 if (lu->lu_watchreq != NULL) { 122 /* 123 * In this case the lock is active. All lockusers 124 * keep their watch request and drop their own 125 * (lu_myreq) request. Their own request is either 126 * some other lockuser's watch request or is the 127 * head of the lock. 128 */ 129 lu->lu_myreq = lu->lu_watchreq; 130 lu->lu_watchreq = NULL; 131 } |
128 if (lu->lu_myreq == NULL) | 132 if (lu->lu_myreq == NULL) |
133 /* 134 * Oops, something isn't quite right. Try to 135 * allocate one. 136 */ |
|
129 return (_lockuser_init(lu, priv)); 130 else { 131 lu->lu_myreq->lr_locked = 1; 132 lu->lu_myreq->lr_watcher = NULL; 133 lu->lu_myreq->lr_owner = lu; 134 lu->lu_myreq->lr_active = 0; 135 lu->lu_watchreq = NULL; 136 lu->lu_priority = 0; --- 218 unchanged lines hidden --- | 137 return (_lockuser_init(lu, priv)); 138 else { 139 lu->lu_myreq->lr_locked = 1; 140 lu->lu_myreq->lr_watcher = NULL; 141 lu->lu_myreq->lr_owner = lu; 142 lu->lu_myreq->lr_active = 0; 143 lu->lu_watchreq = NULL; 144 lu->lu_priority = 0; --- 218 unchanged lines hidden --- |