00001 00008 /* 00009 * The contents of this file are subject to the Mozilla Public License 00010 * Version 1.0 (the "License"); you may not use this file except in 00011 * compliance with the License. You may obtain a copy of the License 00012 * at http://www.mozilla.org/MPL/ 00013 * 00014 * Software distributed under the License is distributed on an "AS IS" 00015 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00016 * the License for the specific language governing rights and 00017 * limitations under the License. 00018 * 00019 * The Original Code is legOS code, released October 17, 1999. 00020 * 00021 * The Initial Developer of the Original Code is Markus L. Noga. 00022 * Portions created by Markus L. Noga are Copyright (C) 1999 00023 * Markus L. Noga. All Rights Reserved. 00024 * 00025 * Contributor(s): Joseph A. Woolley <jawoolley@users.sourceforge.net 00026 */ 00027 00028 #if !defined(__critsec_h__) 00029 #define __critsec_h__ 00030 00031 #if defined(__cplusplus) 00032 extern "C" { 00033 #endif // __cplusplus 00034 00035 #include <config.h> 00036 00037 #if defined(CONF_TM) && defined(CONF_CRITICAL_SECTIONS) 00038 #include <sys/tm.h> 00039 00041 00046 struct critsec { 00047 unsigned char count; 00048 tdata_t* task; 00049 }; 00050 00052 typedef struct critsec critsec_t; 00053 00055 00061 extern int locked_decrement(unsigned char* counter); 00062 00064 00070 extern wakeup_t wait_critical_section(wakeup_t data); 00071 00073 00080 #define initialize_critical_section(cs) (cs)->count=0 00081 00083 00091 extern int enter_critical_section(critsec_t* cs); 00092 00094 00102 #define leave_critical_section(cs) locked_decrement(&(cs)->count) 00103 00105 00112 #define destroy_critical_section(cs) 00113 00114 #endif // CONF_TM && CONF_CRITICAL_SECTIONS 00115 00116 #if defined(__cplusplus) 00117 } 00118 #endif // __cplusplus 00119 00120 #endif // __critsec_h__
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2002 by the authors. |