mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-06 17:39:45 +00:00
wasnt needed
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@694 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
/* $Id$ */
|
||||
/*!
|
||||
* @file Mw/Abstract/Mutex.h
|
||||
* @brief Mutex
|
||||
*/
|
||||
#ifndef __MW_ABSTRACT_MUTEX_H__
|
||||
#define __MW_ABSTRACT_MUTEX_H__
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief Creates a mutex
|
||||
* @return Handle
|
||||
*/
|
||||
MWDECL void* MwMutexCreate(void);
|
||||
|
||||
/*!
|
||||
* @brief Destroys a mutex
|
||||
* @param handle Handle
|
||||
*/
|
||||
MWDECL void MwMutexDestroy(void* handle);
|
||||
|
||||
/*!
|
||||
* @brief Locks a mutex
|
||||
* @param handle Handle
|
||||
*/
|
||||
MWDECL void MwMutexLock(void* handle);
|
||||
|
||||
/*!
|
||||
* @brief Unlocks a mutex
|
||||
* @param handle Handle
|
||||
*/
|
||||
MWDECL void MwMutexUnlock(void* handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <Mw/Abstract/Dynamic.h>
|
||||
#include <Mw/Abstract/Directory.h>
|
||||
#include <Mw/Abstract/Time.h>
|
||||
#include <Mw/Abstract/Mutex.h>
|
||||
|
||||
#include <Mw/Resource/Icon.h>
|
||||
#include <Mw/Resource/Cursor.h>
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
void* MwMutexCreate(void) {
|
||||
return CreateEvent(NULL, FALSE, TRUE, NULL);
|
||||
}
|
||||
|
||||
void MwMutexDestroy(void* handle) {
|
||||
CloseHandle(handle);
|
||||
}
|
||||
|
||||
void MwMutexLock(void* handle) {
|
||||
WaitForSingleObject(handle, INFINITE);
|
||||
}
|
||||
|
||||
void MwMutexUnlock(void* handle) {
|
||||
SetEvent(handle);
|
||||
}
|
||||
#elif defined(__unix__)
|
||||
#include <pthread.h>
|
||||
|
||||
void* MwMutexCreate(void) {
|
||||
pthread_mutex_t* m = malloc(sizeof(*m));
|
||||
|
||||
pthread_mutex_init(m, NULL);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
void MwMutexDestroy(void* handle) {
|
||||
pthread_mutex_destroy(handle);
|
||||
|
||||
free(handle);
|
||||
}
|
||||
|
||||
void MwMutexLock(void* handle) {
|
||||
pthread_mutex_lock(handle);
|
||||
}
|
||||
|
||||
void MwMutexUnlock(void* handle) {
|
||||
pthread_mutex_unlock(handle);
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user