mirror of
https://git.k0rb4k.net/K0RB4K/qotd.git
synced 2026-09-26 21:31:01 +00:00
pthreads testing (have to add a flag in cmake but don't remember which and internet is slow af rn)
This commit is contained in:
@@ -1,8 +1,22 @@
|
||||
#include "server.h"
|
||||
//#include "server.h"
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
void threadTest(void *arg) {
|
||||
char* txt = (char*) arg;
|
||||
puts(txt);
|
||||
pthread_exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// TODO: shell args
|
||||
server(1, 1);
|
||||
pthread_t threadHandle;
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_create(&threadHandle, &attr, (void *(*)(void *)) threadTest, "a");
|
||||
void * ret;
|
||||
pthread_join(threadHandle, &ret);
|
||||
puts(ret);
|
||||
// server(1, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user