12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #include "synch.h"
- /*
- #include "memutil.h"
- TOOLKIT_API int toolkit_mutex_create(toolkit_mutex_t** p_mutex)
- {
- toolkit_mutex_t* mutex;
- mutex = MALLOC_T(toolkit_mutex_t);
- *p_mutex = mutex;
- return 0;
- }
- TOOLKIT_API int toolkit_mutex_init(toolkit_mutex_t* mutex)
- {
- #ifdef _WIN32
- InitializeCriticalSection(mutex);
- #else
- #endif
- FREE(mutex);
- return 0;
- }
- TOOLKIT_API void toolkit_mutex_destroy(toolkit_mutex_t* mutex)
- {
- #ifdef _WIN32
- DeleteCriticalSection(mutex);
- #else
- #endif
- }
- TOOLKIT_API void toolkit_mutex_lock(toolkit_mutex_t* mutex)
- {
- #ifdef _WIN32
- EnterCriticalSection(mutex);
- #else
- #endif
- }
- TOOLKIT_API int toolkit_mutex_trylock(toolkit_mutex_t* mutex)
- {
- #ifdef _WIN32
- if(TryEnterCriticalSection(mutex))
- {
- return 0;
- }
- return -1;
- #else
- #endif
- return 0;
- }
- TOOLKIT_API void toolkit_mutex_unlock(toolkit_mutex_t* mutex)
- {
- #ifdef _WIN32
- LeaveCriticalSection(mutex);
- #else
- #endif
- }
- */
|