Implement window title setting

This commit is contained in:
Cacodemon345
2021-08-23 14:09:43 +06:00
parent 1678783db5
commit e0b36b52ca
3 changed files with 57 additions and 5 deletions

View File

@@ -15,11 +15,28 @@ typedef struct event_pthread_t
int state;
} event_pthread_t;
typedef struct thread_param
{
void (*thread_rout)(void*);
void* param;
} thread_param;
void* thread_run_wrapper(thread_param* arg)
{
thread_param localparam = *arg;
free(arg);
localparam.thread_rout(localparam.param);
return NULL;
}
thread_t *thread_create(void (*thread_rout)(void *param), void *param)
{
pthread_t *thread = malloc(sizeof(pthread_t));
thread_param *thrparam = malloc(sizeof(thread_param));
thrparam->thread_rout = thread_rout;
thrparam->param = param;
pthread_create(thread, NULL, (void*)thread_rout, param);
pthread_create(thread, NULL, (void* (*)(void*))thread_run_wrapper, thrparam);
return thread;
}