raw_sem_post = (int (*)(sem_t*))dlsym(RTLD_NEXT, "sem_post");
}
+static int sthread_inside_simgrid = 1;
+void sthread_enable(void)
+{ // Start intercepting all pthread calls
+ sthread_inside_simgrid = 0;
+}
+void sthread_disable(void)
+{ // Stop intercepting all pthread calls
+ sthread_inside_simgrid = 1;
+}
int pthread_create(pthread_t* thread, const pthread_attr_t* attr, void* (*start_routine)(void*), void* arg)
{
if (raw_pthread_create == NULL)
intercepter_init();
if (sthread_inside_simgrid)
- raw_mutex_init(mutex, attr);
+ return raw_mutex_init(mutex, attr);
sthread_inside_simgrid = 1;
int res = sthread_mutex_init((sthread_mutex_t*)mutex, attr);
fprintf(stderr, "__libc_start_main\n");
/* ... and call it with our custom main function */
return orig(main_hook, argc, argv, init, fini, rtld_fini, stack_end);
-}
\ No newline at end of file
+}