*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
MACRO_END
unsigned int lock_set_event;
-#define LOCK_SET_EVENT ((event_t)&lock_set_event)
+#define LOCK_SET_EVENT ((event64_t)&lock_set_event)
unsigned int lock_set_handoff;
-#define LOCK_SET_HANDOFF ((event_t)&lock_set_handoff)
+#define LOCK_SET_HANDOFF ((event64_t)&lock_set_handoff)
/*
* ROUTINE: lock_set_init [private]
if (ulock->accept_wait) {
ulock->accept_wait = FALSE;
- wait_queue_wakeup_one(&ulock->wait_queue,
+ wait_queue_wakeup64_one(&ulock->wait_queue,
LOCK_SET_HANDOFF,
THREAD_RESTART);
}
if (ulock->holder) {
if (ulock->blocked) {
ulock->blocked = FALSE;
- wait_queue_wakeup_all(&ulock->wait_queue,
+ wait_queue_wakeup64_all(&ulock->wait_queue,
LOCK_SET_EVENT,
THREAD_RESTART);
}
if (ulock->ho_wait) {
ulock->ho_wait = FALSE;
- wait_queue_wakeup_one(&ulock->wait_queue,
+ wait_queue_wakeup64_one(&ulock->wait_queue,
LOCK_SET_HANDOFF,
THREAD_RESTART);
}
if (ulock->holder != THR_ACT_NULL) {
int wait_result;
- lock_set_unlock(lock_set);
-
if (ulock->holder == current_act()) {
ulock_unlock(ulock);
return KERN_LOCK_OWNED_SELF;
}
ulock->blocked = TRUE;
- wait_queue_assert_wait(&ulock->wait_queue,
+ wait_result = wait_queue_assert_wait64(&ulock->wait_queue,
LOCK_SET_EVENT,
THREAD_ABORTSAFE);
ulock_unlock(ulock);
/*
* Block - Wait for lock to become available.
*/
-
- wait_result = thread_block((void (*)(void))0);
+ if (wait_result == THREAD_WAITING)
+ wait_result = thread_block(THREAD_CONTINUE_NULL);
/*
* Check the result status:
if (ulock->holder != thr_act) {
ulock_unlock(ulock);
- lock_set_unlock(lock_set);
return KERN_INVALID_RIGHT;
}
s = splsched();
wait_queue_lock(wq);
- thread = wait_queue_wakeup_identity_locked(wq,
+ thread = wait_queue_wakeup64_identity_locked(wq,
LOCK_SET_EVENT,
THREAD_AWAKENED,
TRUE);
if (ulock->holder != current_act()) {
ulock_unlock(ulock);
- lock_set_unlock(lock_set);
return KERN_INVALID_RIGHT;
}
*/
s = splsched();
wait_queue_lock(wq);
- thread = wait_queue_wakeup_identity_locked(
+ thread = wait_queue_wakeup64_identity_locked(
wq,
LOCK_SET_HANDOFF,
THREAD_AWAKENED,
* for an accepting thread.
*/
ulock->ho_wait = TRUE;
- wait_queue_assert_wait(&ulock->wait_queue,
+ wait_result = wait_queue_assert_wait64(&ulock->wait_queue,
LOCK_SET_HANDOFF,
THREAD_ABORTSAFE);
ulock_unlock(ulock);
- ETAP_SET_REASON(current_thread(), BLOCKED_ON_LOCK_HANDOFF);
- wait_result = thread_block((void (*)(void))0);
+ if (wait_result == THREAD_WAITING)
+ wait_result = thread_block(THREAD_CONTINUE_NULL);
/*
* If the thread was woken-up via some action other than
assert(ulock->holder != THR_ACT_NULL);
thread = ulock->holder->thread;
- if (wait_queue_wakeup_thread(wq,
+ if (wait_queue_wakeup64_thread(wq,
LOCK_SET_HANDOFF,
thread,
THREAD_AWAKENED) == KERN_SUCCESS) {
}
ulock->accept_wait = TRUE;
- wait_queue_assert_wait(&ulock->wait_queue,
+ wait_result = wait_queue_assert_wait64(&ulock->wait_queue,
LOCK_SET_HANDOFF,
THREAD_ABORTSAFE);
ulock_unlock(ulock);
- ETAP_SET_REASON(current_thread(), BLOCKED_ON_LOCK_HANDOFF);
- wait_result = thread_block((void (*)(void))0);
+ if (wait_result == THREAD_WAITING)
+ wait_result = thread_block(THREAD_CONTINUE_NULL);
/*
* If the thread was woken-up via some action other than