diff --git a/CMakeLists.txt b/CMakeLists.txt index 04399a5..0268fd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,11 @@ set(CMAKE_MACOSX_RPATH 0) set(LIBCO_VERSION 0.5) # Set cflags -set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -g -fno-strict-aliasing -O2 -Wall -export-dynamic -Wall -pipe -D_GNU_SOURCE -D_REENTRANT -fPIC -Wno-deprecated -m64) +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -g -fno-strict-aliasing -O0 -Wall -export-dynamic -Wall -pipe -D_GNU_SOURCE -D_REENTRANT -fPIC -Wno-deprecated -m64) +else() + set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -g -fno-strict-aliasing -O2 -Wall -export-dynamic -Wall -pipe -D_GNU_SOURCE -D_REENTRANT -fPIC -Wno-deprecated -m64) +endif() # Use c and asm enable_language(C ASM) diff --git a/example_thread.cpp b/example_thread.cpp index 4017710..5c7fafd 100644 --- a/example_thread.cpp +++ b/example_thread.cpp @@ -39,6 +39,10 @@ static void *routine_func( void * ) } int main(int argc,char *argv[]) { + if (arac != 2) { + printf("Usage:./example_thread x"); + return -1; + } int cnt = atoi( argv[1] ); pthread_t tid[ cnt ];