1 parent
eebbc88a2c
commit
b70ee2d359
5 files changed
+16
-16
No files matched your search
+4
-4
@@ -22,10 +22,10 @@ typedef struct CgeMutex CgeMutex;
|
|||||||
typedef struct CgeSemaphore CgeSemaphore;
|
typedef struct CgeSemaphore CgeSemaphore;
|
||||||
typedef struct CgeCondition CgeCondition;
|
typedef struct CgeCondition CgeCondition;
|
||||||
typedef struct CgeTss CgeTss;
|
typedef struct CgeTss CgeTss;
|
||||||
typedef int (*CgeThreadCallback)(void *);
|
typedef int (*CgeThreadCb)(void *);
|
||||||
typedef void (*CgeTssCallback)(void *);
|
typedef void (*CgeTssCb)(void *);
|
||||||
|
|
||||||
CgeThread *CgeThreadNew(size_t stack, CgeThreadCallback callback, void *data,
|
CgeThread *CgeThreadNew(size_t stack, CgeThreadCb callback, void *data,
|
||||||
int *result);
|
int *result);
|
||||||
int CgeThreadJoin(CgeThread *thread, int *result);
|
int CgeThreadJoin(CgeThread *thread, int *result);
|
||||||
int CgeThreadDetach(CgeThread *thread, int *result);
|
int CgeThreadDetach(CgeThread *thread, int *result);
|
||||||
@@ -52,7 +52,7 @@ int CgeConditionWaitFor(CgeCondition *condition, CgeMutex *mutex,
|
|||||||
int CgeConditionSignal(CgeCondition *condition, int *result);
|
int CgeConditionSignal(CgeCondition *condition, int *result);
|
||||||
int CgeConditionBroadcast(CgeCondition *condition, int *result);
|
int CgeConditionBroadcast(CgeCondition *condition, int *result);
|
||||||
|
|
||||||
CgeTss *CgeTssNew(CgeTssCallback callback, int *result);
|
CgeTss *CgeTssNew(CgeTssCb callback, int *result);
|
||||||
void CgeTssFree(CgeTss *tss);
|
void CgeTssFree(CgeTss *tss);
|
||||||
void *CgeTssRead(CgeTss *tss);
|
void *CgeTssRead(CgeTss *tss);
|
||||||
void CgeTssWrite(CgeTss *tss, void *value);
|
void CgeTssWrite(CgeTss *tss, void *value);
|
||||||
|
|||||||
+5
-5
@@ -5,12 +5,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
struct CgeThreadContext {
|
struct CgeThreadContext {
|
||||||
CgeThreadCallback callback;
|
CgeThreadCb callback;
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *threadRun(void *context) {
|
static void *threadRun(void *context) {
|
||||||
CgeThreadCallback callback;
|
CgeThreadCb callback;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
callback = ((struct CgeThreadContext *)context)->callback;
|
callback = ((struct CgeThreadContext *)context)->callback;
|
||||||
@@ -20,8 +20,8 @@ static void *threadRun(void *context) {
|
|||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int threadInit(CgeThread *thread, size_t stack,
|
static int threadInit(CgeThread *thread, size_t stack, CgeThreadCb callback,
|
||||||
CgeThreadCallback callback, void *data, int *result) {
|
void *data, int *result) {
|
||||||
struct CgeThreadContext *context;
|
struct CgeThreadContext *context;
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ static int threadInit(CgeThread *thread, size_t stack,
|
|||||||
return code == CGE_THREAD_EOK;
|
return code == CGE_THREAD_EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
CgeThread *CgeThreadNew(size_t stack, CgeThreadCallback callback, void *data,
|
CgeThread *CgeThreadNew(size_t stack, CgeThreadCb callback, void *data,
|
||||||
int *result) {
|
int *result) {
|
||||||
CgeThread *thread;
|
CgeThread *thread;
|
||||||
int code = CGE_THREAD_EOOM;
|
int code = CGE_THREAD_EOOM;
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
CgeTss *CgeTssNew(CgeTssCallback callback, int *result) {
|
CgeTss *CgeTssNew(CgeTssCb callback, int *result) {
|
||||||
CgeTss *tss;
|
CgeTss *tss;
|
||||||
int code = CGE_THREAD_EOOM;
|
int code = CGE_THREAD_EOOM;
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -3,12 +3,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
struct CgeThreadContext {
|
struct CgeThreadContext {
|
||||||
CgeThreadCallback callback;
|
CgeThreadCb callback;
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned __stdcall threadRun(void *context) {
|
static unsigned __stdcall threadRun(void *context) {
|
||||||
CgeThreadCallback callback;
|
CgeThreadCb callback;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
callback = ((struct CgeThreadContext *)context)->callback;
|
callback = ((struct CgeThreadContext *)context)->callback;
|
||||||
@@ -18,8 +18,8 @@ static unsigned __stdcall threadRun(void *context) {
|
|||||||
_endthreadex(0);
|
_endthreadex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int threadInit(CgeThread *thread, size_t stack,
|
static int threadInit(CgeThread *thread, size_t stack, CgeThreadCb callback,
|
||||||
CgeThreadCallback callback, void *data, int *result) {
|
void *data, int *result) {
|
||||||
struct CgeThreadContext *context;
|
struct CgeThreadContext *context;
|
||||||
|
|
||||||
context = malloc(sizeof(*context));
|
context = malloc(sizeof(*context));
|
||||||
@@ -42,7 +42,7 @@ static int threadInit(CgeThread *thread, size_t stack,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CgeThread *CgeThreadNew(size_t stack, CgeThreadCallback callback, void *data,
|
CgeThread *CgeThreadNew(size_t stack, CgeThreadCb callback, void *data,
|
||||||
int *result) {
|
int *result) {
|
||||||
CgeThread *thread;
|
CgeThread *thread;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#include "Internal.h"
|
#include "Internal.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
CgeTss *CgeTssCreate(CgeTssCallback callback, int *result) {
|
CgeTss *CgeTssCreate(CgeTssCb callback, int *result) {
|
||||||
CgeTss *tss;
|
CgeTss *tss;
|
||||||
int code = CGE_THREAD_EOOM;
|
int code = CGE_THREAD_EOOM;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user