/* * Copyright 2007 * Green Hills Software, Inc. * * This program is the property of Green Hills Software, Inc, * its contents are proprietary information and no part of it * is to be disclosed to anyone except employees of Green Hills * Software, Inc., or as agreed in writing signed by the President * of Green Hills Software, Inc. * */ #include "ind_thrd.h" #include #include #include #include #include #if !defined(MINIMAL_STARTUP) /* Acquire global lock. Blocks until the lock becomes available. */ #if 0 // CAFE GHS ORIG void __ghsLock(void) { } #endif // CAFE GHS ORIG /* Release global lock */ #if 0 // CAFE GHS ORIG void __ghsUnlock(void) { } #endif // CAFE GHS ORIG #endif /* !defined(MINIMAL_STARTUP) */ /* A callback to initialize the lock data structure before it is used. */ #if 0 // CAFE GHS ORIG void __gh_lock_init(void) { } #endif // CAFE GHS ORIG #define MUTEX_ALIGN 8 void __ghs_mtx_init(void *mtx) { OSMutex **mutex_ptr_ptr = (OSMutex **)mtx; *mutex_ptr_ptr = (OSMutex *)MEMAllocFromDefaultHeapEx(sizeof(OSMutex), MUTEX_ALIGN); OSInitMutex(*mutex_ptr_ptr); } void __ghs_mtx_dst(void *mtx) { OSMutex **mutex_ptr_ptr = (OSMutex **)mtx; MEMFreeToDefaultHeap(*mutex_ptr_ptr); *mutex_ptr_ptr = NULL; } void __ghs_mtx_lock(void *mtx) { OSMutex **mutex_ptr_ptr = (OSMutex **)mtx; OSLockMutex(*mutex_ptr_ptr); } void __ghs_mtx_unlock(void *mtx) { OSMutex **mutex_ptr_ptr = (OSMutex **)mtx; OSUnlockMutex(*mutex_ptr_ptr); }