eosPThread(API)

提供: Eospedia
2014年5月20日 (火) 08:28時点におけるKinoshita (トーク | 投稿記録)による版

移動: 案内検索

General/eosPThreadはAPI です。

定数

typedef enum eosPThreadStatus {
	eosPThreadStatusWaiting = 0,
	eosPThreadStatusRunning = 1
} eosPThreadStatus;

構造体

extern int __eosPThread__;
extern int __eosPThreadNum__;
typedef struct eosPThread {
	pthread_t* 			th;         /* [max] thread */
	eosPThreadStatus* 	status;     /* [max] thread status */
	long*				id;         /* [max] thread ID indicated by count */

	int 				max;		/* maximum thread number working simultaneously. */ 
	long				count;		/* count of created threads */	 
	long				latest;     /* working thread ID which started latest */
	long				oldest;     /* working thread ID which started oldest */

	pthread_mutex_t     mutex;
	pthread_mutexattr_t mutex_attr;
} eosPThread;

API

extern void eosPThreadInit   (eosPThread* t, int max, int mode);
extern int  eosPThreadCreateOnWaitingThread (eosPThread* t, void* (*start_routine)(void *), void * arg, int mode);
extern int  eosPThreadCreate (eosPThread* t, int i, void* (*start_routine)(void *), void * arg, int mode);
extern void eosPThreadJoin   (eosPThread* t, int i, int mode);
extern void eosPThreadJoinAll(eosPThread* t, int mode);
extern void eosPThreadMutexInit(eosPThread* t);
extern void eosPThreadMutexDestroy(eosPThread* t);
extern void eosPThreadMutexLock(eosPThread* t);
extern void eosPThreadMutexUnlock(eosPThread* t);