pthreads test with the compiler options now
This commit is contained in:
parent
195d4352a0
commit
ee2eecf6a2
@ -3,4 +3,9 @@ project(qotd C)
|
|||||||
|
|
||||||
set(CMAKE_C_STANDARD 99)
|
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
2
main.c
@ -15,7 +15,7 @@ int main(int argc, char *argv[]) {
|
|||||||
pthread_create(&threadHandle, &attr, (void *(*)(void *)) threadTest, "a");
|
pthread_create(&threadHandle, &attr, (void *(*)(void *)) threadTest, "a");
|
||||||
void * ret;
|
void * ret;
|
||||||
pthread_join(threadHandle, &ret);
|
pthread_join(threadHandle, &ret);
|
||||||
puts(ret);
|
printf("%d", ret);
|
||||||
// server(1, 1);
|
// server(1, 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user