mirror of
https://github.com/solemnwarning/ipxwrapper
synced 2024-12-30 16:45:37 +01:00
Fixed bugs in mutex functions
This commit is contained in:
parent
192365e8e8
commit
b599cd6fa1
@ -47,7 +47,6 @@ static FILE *debug_fh = NULL;
|
|||||||
static HANDLE mutex = NULL;
|
static HANDLE mutex = NULL;
|
||||||
static HANDLE router_thread = NULL;
|
static HANDLE router_thread = NULL;
|
||||||
static DWORD router_tid = 0;
|
static DWORD router_tid = 0;
|
||||||
static int mutex_locked = 0;
|
|
||||||
|
|
||||||
static HMODULE load_sysdll(char const *name);
|
static HMODULE load_sysdll(char const *name);
|
||||||
static int init_router(void);
|
static int init_router(void);
|
||||||
@ -202,18 +201,12 @@ ipx_socket *get_socket(SOCKET fd) {
|
|||||||
|
|
||||||
/* Lock the mutex */
|
/* Lock the mutex */
|
||||||
void lock_mutex(void) {
|
void lock_mutex(void) {
|
||||||
if(mutex_locked) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitForSingleObject(mutex, INFINITE);
|
WaitForSingleObject(mutex, INFINITE);
|
||||||
mutex_locked++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unlock the mutex */
|
/* Unlock the mutex */
|
||||||
void unlock_mutex(void) {
|
void unlock_mutex(void) {
|
||||||
mutex_locked = 0;
|
while(ReleaseMutex(mutex)) {}
|
||||||
ReleaseMutex(mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IP_ADAPTER_INFO *get_nics(void) {
|
IP_ADAPTER_INFO *get_nics(void) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user