pthreads test with the compiler options now

This commit is contained in:
Arthur-Coppey 2022-03-10 16:51:55 +01:00
parent 195d4352a0
commit ee2eecf6a2
2 changed files with 7 additions and 2 deletions

View File

@ -3,4 +3,9 @@ project(qotd C)
set(CMAKE_C_STANDARD 99)
add_executable(qotd main.c quote.c quote.h server.c server.h config.h)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
add_executable(qotd main.c quote.c quote.h server.c server.h config.h)
target_link_libraries(qotd Threads::Threads)

2
main.c
View File

@ -15,7 +15,7 @@ int main(int argc, char *argv[]) {
pthread_create(&threadHandle, &attr, (void *(*)(void *)) threadTest, "a");
void * ret;
pthread_join(threadHandle, &ret);
puts(ret);
printf("%d", ret);
// server(1, 1);
return 0;