-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
While working on #37 any sort of release build was segfaulting. After some investigation I found out that the reason for this is that CMake defaults to defining NDEBUG in release builds. Looking at
Line 65 in 1f27c7d
| assert(pthread_create(&threads[thread], NULL, thread_function, (void *)(thhandle->targs[thread])) == 0); |
pthread_join segfaults.
A possible fix, which I confirmed to work, is:
diff --git a/helsing/src/main.c b/helsing/src/main.c
index f0028c6..4ee5bba 100644
--- a/helsing/src/main.c
+++ b/helsing/src/main.c
@@ -61,8 +61,10 @@ int main(int argc, char *argv[])
continue;
fprintf(stderr, "Checking interval: [%llu, %llu]\n", lmin, lmax);
- for (thread_t thread = 0; thread < options.threads; thread++)
- assert(pthread_create(&threads[thread], NULL, thread_function, (void *)(thhandle->targs[thread])) == 0);
+ for (thread_t thread = 0; thread < options.threads; thread++) {
+ int pthread_create_return = pthread_create(&threads[thread], NULL, thread_function, (void*) (thhandle->targs[thread]));
+ assert(pthread_create_return == 0);
+ }
for (thread_t thread = 0; thread < options.threads; thread++)
pthread_join(threads[thread], 0);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels