00001 #ifndef _ofxMultiThread_h_ 00002 #define _ofxMultiThread_h_ 00003 00004 /* 00005 Software License : 00006 00007 Copyright (c) 2003-2004, The Foundry Visionmongers Ltd. All rights reserved. 00008 00009 Redistribution and use in source and binary forms, with or without 00010 modification, are permitted provided that the following conditions are met: 00011 00012 * Redistributions of source code must retain the above copyright notice, 00013 this list of conditions and the following disclaimer. 00014 * Redistributions in binary form must reproduce the above copyright notice, 00015 this list of conditions and the following disclaimer in the documentation 00016 and/or other materials provided with the distribution. 00017 * Neither the name The Foundry Visionmongers Ltd, nor the names of its 00018 contributors may be used to endorse or promote products derived from this 00019 software without specific prior written permission. 00020 00021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00024 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 00025 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00026 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00027 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00028 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00030 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 */ 00032 00033 00034 #include "ofxCore.h" 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00045 #define kOfxMultiThreadSuite "OfxMultiThreadSuite" 00046 00049 typedef struct OfxMutex *OfxMutexHandle; 00050 00059 typedef void (OfxThreadFunctionV1)(unsigned int threadIndex, 00060 unsigned int threadMax, 00061 void *customArg); 00062 00065 typedef struct OfxMultiThreadSuiteV1 { 00090 OfxStatus (*multiThread)(OfxThreadFunctionV1 func, 00091 unsigned int nThreads, 00092 void *customArg); 00093 00104 OfxStatus (*multiThreadNumCPUs)(unsigned int *nCPUs); 00105 00118 OfxStatus (*multiThreadIndex)(unsigned int *threadIndex); 00119 00126 int (*multiThreadIsSpawnedThread)(void); 00127 00138 OfxStatus (*mutexCreate)(const OfxMutexHandle *mutex, int lockCount); 00139 00148 OfxStatus (*mutexDestroy)(const OfxMutexHandle mutex); 00149 00160 OfxStatus (*mutexLock)(const OfxMutexHandle mutex); 00161 00170 OfxStatus (*mutexUnLock)(const OfxMutexHandle mutex); 00171 00183 OfxStatus (*mutexTryLock)(const OfxMutexHandle mutex); 00184 00185 } OfxMultiThreadSuiteV1; 00186 00187 #ifdef __cplusplus 00188 } 00189 #endif 00190 00191 00192 #endif