mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-01 23:46:37 +02:00
Updated the win32 thread code (maybe it will work now?)
This commit is contained in:
@@ -545,5 +545,4 @@ seen. gmtime warning still there
|
||||
- Added scan_socks.c, added and moved some stuff to
|
||||
include/modules/scan.h (the dir too)
|
||||
- Converted threads to IRC*Thread by codemastr.
|
||||
|
||||
|
||||
- Updated the win32 thread code (maybe it will work now?)
|
||||
|
||||
+5
-7
@@ -30,25 +30,23 @@
|
||||
#include <pthread.h>
|
||||
typedef pthread_attr_t THREAD_ATTR;
|
||||
typedef pthread_t THREAD;
|
||||
typedef short THREAD_ID; /* not needed, but makes porting easier */
|
||||
typedef pthread_mutex_t MUTEX;
|
||||
#define IRCCreateThread(threadid, thread, attr, start, arg) pthread_attr_init(&attr); pthread_create(&thread, &attr, (void*)start, arg)
|
||||
#define IRCCreateThread(thread, attr, start, arg) pthread_attr_init(&attr); pthread_create(&thread, &attr, (void*)start, arg)
|
||||
#define IRCMutexLock(mutex) pthread_mutex_lock(&mutex)
|
||||
#define IRCMutexUnlock(mutex) pthread_mutex_unlock(&mutex)
|
||||
#define IRCCreateMutex(mutex) pthread_mutex_init(&mutex, NULL)
|
||||
#define IRCMutexDestroy(mutex) pthread_mutex_destroy(&mutex)
|
||||
#define IRCExitThread(x) pthread_exit(x)
|
||||
#else
|
||||
typedef SECURITY_ATTRIBUTES THREAD_ATTR;
|
||||
typedef HANDLE THREAD;
|
||||
typedef PULONG THREAD_ID;
|
||||
typedef short THREAD_ATTR; /* Not needed but makes porting easier */
|
||||
typedef unsigned long THREAD;
|
||||
typedef HANDLE MUTEX;
|
||||
#define IRCCreateThread(threadid, thread, attr, start, arg) thread = CreateThread(&attr, 0, (LPTHREAD_START_ROUTINE)start, arg, 0, &threadid)
|
||||
#define IRCCreateThread(thread, attr, start, arg) thread = _beginthread((void *)start, 0, arg)
|
||||
#define IRCMutexLock(mutex) WaitForSingleObject(mutex, INFINITE)
|
||||
#define IRCMutexUnlock(mutex) ReleaseMutex(mutex)
|
||||
#define IRCCreateMutex(mutex) mutex = CreateMutex(NULL, TRUE, NULL)
|
||||
#define IRCMutexDestroy(mutex) CloseHandle(mutex)
|
||||
#define IRCExitThread(x) ExitThread(x)
|
||||
#define IRCExitThread(x) _endthread(x)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+3
-4
@@ -255,10 +255,9 @@ DLLFUNC int h_scan_connect(aClient *sptr)
|
||||
{
|
||||
Hook *hook;
|
||||
HStruct *h;
|
||||
vFP *vfp;
|
||||
vFP *vfp;
|
||||
THREAD thread;
|
||||
THREAD_ATTR thread_attr;
|
||||
THREAD_ID id;
|
||||
THREAD_ATTR thread_attr;
|
||||
|
||||
IRCMutexLock(HSlock);
|
||||
HS_Cleanup((void *)1);
|
||||
@@ -276,7 +275,7 @@ DLLFUNC int h_scan_connect(aClient *sptr)
|
||||
{
|
||||
h->refcnt++;
|
||||
/* Create thread for connection */
|
||||
IRCCreateThread(id, thread, thread_attr, (hook->func.voidfunc), h);
|
||||
IRCCreateThread(thread, thread_attr, (hook->func.voidfunc), h);
|
||||
}
|
||||
IRCMutexUnlock(HSlock);
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user