00001 00006 /* 00007 * The contents of this file are subject to the Mozilla Public License 00008 * Version 1.0 (the "License"); you may not use this file except in 00009 * compliance with the License. You may obtain a copy of the License 00010 * at http://www.mozilla.org/MPL/ 00011 * 00012 * Software distributed under the License is distributed on an "AS IS" 00013 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00014 * the License for the specific language governing rights and 00015 * limitations under the License. 00016 * 00017 * The Original Code is legOS code, released October 17, 1999. 00018 * 00019 * The Initial Developer of the Original Code is Markus L. Noga. 00020 * Portions created by Markus L. Noga are Copyright (C) 1999 00021 * Markus L. Noga. All Rights Reserved. 00022 * 00023 * Contributor(s): Markus L. Noga <markus@noga.de> 00024 */ 00025 00026 #ifndef __semaphore_h__ 00027 #define __semaphore_h__ 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00033 #include <config.h> 00034 00035 #ifdef CONF_SEMAPHORES 00036 00038 // 00039 // Definitions 00040 // 00042 00043 typedef unsigned char sem_t; 00044 00045 #define EAGAIN 0xffff 00046 00047 00048 // 00049 // Functions 00050 // 00052 00054 00061 extern inline int sem_init(sem_t * sem, int pshared, unsigned int value) 00062 { 00063 *sem = (sem_t) value; 00064 return 0; 00065 } 00066 00068 00075 extern int sem_wait(sem_t * sem); 00076 00078 00088 extern int sem_trywait(sem_t * sem); 00089 00091 00097 extern int sem_post(sem_t * sem); 00098 00099 // 00101 // 00102 extern inline int sem_getvalue(sem_t * sem, int *sval) 00103 { 00104 *sval = *sem; 00105 return 0; 00106 } 00107 00109 00117 extern inline int sem_destroy(sem_t * sem) 00118 { 00119 return 0; 00120 } 00121 00122 #endif // CONF_SEMAPHORES 00123 00124 #ifdef __cplusplus 00125 } 00126 #endif 00127 00128 #endif // __semaphore_h__
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2002 by the authors. |