⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thread.h

📁 D-ITG2.4源代码
💻 H
字号:
 /*	Component of the D-ITG 2.4 Platform
 *
 * 	
 *	copyright	: (C) 2004  	by Stefano Avallone, Alessio Botta, Donato Emma, 
 *					Salvatore Guadagno, Antonio Pescape'
 *					DIS Dipartimento di Informatica e Sistemistica				 
 *					(Computer Science Department)
 *					University of Naples "Federico II"	
 *	email:		: {stavallo, pescape}@unina.it, {abotta, demma, sguadagno}@napoli.consorzio-cini.it
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 */
 
 



#ifdef WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iostream.h>

typedef HANDLE pthread_t;
extern char nameProgram[];

#endif

#ifdef LINUX_OS
#include <pthread.h>
#include <iostream.h>
#include <unistd.h>
#endif



#ifdef WIN32

#define MUTEX_THREAD_LOCK(a) \
	mutexThreadLock(a)


#define MUTEX_THREAD_UNLOCK(a) \
	mutexThreadUnlock(a)


#define MUTEX_THREAD_RELEASE(a) \
	mutexThreadRelease(a)


#define CREATE_THREAD(a,b,c,d) \
	createThread(a,b,c,d)
	

#define MUTEX_THREAD_INIT(a) \
	mutexThreadInit(a)

#endif

#ifdef LINUX_OS

#define MUTEX_THREAD_LOCK(a) \
	mutexThreadLock(&a)


#define MUTEX_THREAD_UNLOCK(a) \
	mutexThreadUnlock(&a)


#define MUTEX_THREAD_RELEASE(a) \
	mutexThreadRelease(&a)


#define CREATE_THREAD(a,b,c,d) \
	createThread(a,b,c,d)
	

#define MUTEX_THREAD_INIT(a) \
	mutexThreadInit(&a)

#endif





int createThread(void *argument, void *(nameFunction) (void *), void *attrib, pthread_t& idThread);


int joinThread(int numFlow, pthread_t hThr[]);


int terminateThread(pthread_t idThread);


void exitThread();



#ifdef WIN32

int mutexThreadInit(HANDLE &mutex);
#endif

#ifdef LINUX_OS

int mutexThreadInit(void* mutex);
#endif


int mutexThreadRelease(void* mutex);


int mutexThreadLock(void* mutex);


int mutexThreadUnlock(void* mutex);




int closeSock(int socket);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -