1 /* 2 * Copyright (C) 1997-2005, R3vis Corporation. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 17 * USA, or visit http://www.gnu.org/copyleft/lgpl.html. 18 * 19 * Original Contributor: 20 * Wes Bethel, R3vis Corporation, Marin County, California 21 * Additional Contributor(s): 22 * 23 * The OpenRM project is located at http://openrm.sourceforge.net/. 24 */ 25 /* 26 * $Id: rmthread.h,v 1.6 2005/02/19 16:47:24 wes Exp $ 27 * Version: $Name: OpenRM-1-6-0-2-RC2 $ 28 * $Revision: 1.6 $ 29 * $Log: rmthread.h,v $ 30 * Revision 1.6 2005/02/19 16:47:24 wes 31 * Distro sync and consolidation. 32 * 33 * Revision 1.5 2005/01/23 17:17:02 wes 34 * Copyright update to 2005. 35 * 36 * Revision 1.4 2004/01/17 04:06:42 wes 37 * Updated Copyright line for 2004. 38 * 39 * Revision 1.3 2003/04/05 14:15:03 wes 40 * Renamed rmMutexDestroy to rmMutexDelete. 41 * 42 * Revision 1.2 2003/02/02 02:07:14 wes 43 * Updated copyright to 2003. 44 * 45 * Revision 1.1.1.1 2003/01/28 02:15:23 wes 46 * Manual rebuild of rm150 repository. 47 * 48 * Revision 1.3 2002/04/30 19:42:33 wes 49 * Updated copyright dates. 50 * 51 * Revision 1.2 2001/03/31 17:13:59 wes 52 * v1.4.0-alpha-2 checkin 53 * 54 * Revision 1.1 2000/12/03 23:23:23 wes 55 * Initial entry. 56 * 57 */ 58 59 #ifndef __rmthread_h_ 60 #define __rmthread_h_ 61 62 /* 63 * this file contains definitions for a platform neutral interface 64 * to threads and mutexes. these definitions don't necessarily 65 * implement all features of mutexes and threads that you might 66 * expect, but enough features are implemented for our purposes: 67 * creation of a multistage, multithreaded framework for rendering. 68 */ 69 70 #ifdef RM_X 71 #include <pthread.h> 72 #include <semaphore.h> 73 #else /* RM_WIN */ 74 #include <windows.h> 75 #include <process.h> 76 #endif 77 78 #ifdef __cplusplus 79 extern "C" { 80 #endif 81 82 #ifdef RM_X 83 84 typedef pthread_mutex_t RMmutex; 85 typedef pthread_t RMthread; 86 87 #else /* RM_WIN */ 88 89 typedef HANDLE RMmutex; 90 typedef unsigned long RMthread; 91 92 #endif 93 94 RM_EXPORT_API RMmutex * rmMutexNew(RMenum initLockState); 95 RM_EXPORT_API RMenum rmMutexDelete(RMmutex *); 96 RM_EXPORT_API RMenum rmMutexLock(RMmutex *); 97 RM_EXPORT_API RMenum rmMutexUnlock(RMmutex *); 98 RM_EXPORT_API RMenum rmMutexTryLock(RMmutex *toQuery); 99 100 RM_EXPORT_API RMenum rmThreadCreate(RMthread *threadID, void * (*threadFunc)(void *), void *args); 101 RM_EXPORT_API RMenum rmThreadJoin (RMthread *threadID, void **threadReturn); 102 103 104 #ifdef __cplusplus 105 } 106 #endif 107 108 #endif 109 /* EOF */ 110