|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * The contents of this file constitute Original Code as defined in and ! 7: * are subject to the Apple Public Source License Version 1.1 (the ! 8: * "License"). You may not use this file except in compliance with the ! 9: * License. Please obtain a copy of the License at ! 10: * http://www.apple.com/publicsource and read it before using this file. ! 11: * ! 12: * This Original Code and all software distributed under the License are ! 13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 17: * License for the specific language governing rights and limitations ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: * @OSF_COPYRIGHT@ ! 24: * ! 25: */ ! 26: /* ! 27: * File: kern/sync_sema.h ! 28: * Author: Joseph CaraDonna ! 29: * ! 30: * Contains RT distributed semaphore synchronization service definitions. ! 31: */ ! 32: ! 33: #ifndef _KERN_SYNC_SEMA_H_ ! 34: #define _KERN_SYNC_SEMA_H_ ! 35: ! 36: #include <kern/kern_types.h> ! 37: ! 38: #ifdef MACH_KERNEL_PRIVATE ! 39: ! 40: #include <kern/queue.h> ! 41: #include <kern/lock.h> ! 42: #include <kern/wait_queue.h> ! 43: ! 44: typedef struct semaphore { ! 45: queue_chain_t task_link; /* chain of semaphores owned by a task */ ! 46: struct wait_queue wait_queue; /* queue of blocked threads & lock */ ! 47: task_t owner; /* task that owns semaphore */ ! 48: ipc_port_t port; /* semaphore port */ ! 49: int ref_count; /* reference count */ ! 50: int count; /* current count value */ ! 51: boolean_t active; /* active status */ ! 52: } Semaphore; ! 53: ! 54: ! 55: #endif /* MACH_KERNEL_PRIVATE */ ! 56: ! 57: /* ! 58: * Forward Declarations ! 59: */ ! 60: extern kern_return_t semaphore_create (task_t task, ! 61: semaphore_t *new_semaphore, ! 62: int policy, ! 63: int value); ! 64: ! 65: extern kern_return_t semaphore_destroy (task_t task, ! 66: semaphore_t semaphore); ! 67: ! 68: extern void semaphore_reference (semaphore_t semaphore); ! 69: extern void semaphore_dereference (semaphore_t semaphore); ! 70: ! 71: extern kern_return_t semaphore_signal (semaphore_t semaphore); ! 72: extern kern_return_t semaphore_signal_all (semaphore_t semaphore); ! 73: extern kern_return_t semaphore_signal_thread (semaphore_t semaphore, ! 74: thread_act_t thread_act); ! 75: extern kern_return_t semaphore_wait (semaphore_t semaphore); ! 76: extern kern_return_t semaphore_timedwait (semaphore_t semaphore, ! 77: mach_timespec_t wait_time); ! 78: ! 79: #endif /* _KERN_SYNC_SEMA_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.