Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MC: apply some sonar advices
[simgrid.git] / src / sthread / sthread.h
index 6e7d4f8..e13357b 100644 (file)
@@ -7,13 +7,25 @@
  *
  * The sthread_* symbols are those actual implementations, used in the pthread_* redefinitions. */
 
+#ifndef SIMGRID_STHREAD_H
+#define SIMGRID_STHREAD_H
+
+#include <sys/time.h>
+
+#if defined(__ELF__)
+#define XBT_PUBLIC __attribute__((visibility("default")))
+#else
+#define XBT_PUBLIC
+#endif
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
-extern int
-    sthread_inside_simgrid; // allows logs and library constructors to disable the interception on pthread operations
 
+// Launch the simulation. The old main function (passed as a parameter) is launched as an actor
 int sthread_main(int argc, char** argv, char** envp, int (*raw_main)(int, char**, char**));
+XBT_PUBLIC void sthread_enable(void);  // Start intercepting all pthread calls
+XBT_PUBLIC void sthread_disable(void); // Stop intercepting all pthread calls
 
 typedef unsigned long int sthread_t;
 int sthread_create(sthread_t* thread, const /*pthread_attr_t*/ void* attr, void* (*start_routine)(void*), void* arg);
@@ -28,6 +40,11 @@ int sthread_mutex_trylock(sthread_mutex_t* mutex);
 int sthread_mutex_unlock(sthread_mutex_t* mutex);
 int sthread_mutex_destroy(sthread_mutex_t* mutex);
 
+int sthread_gettimeofday(struct timeval* tv);
+void sthread_sleep(double seconds);
+
 #if defined(__cplusplus)
 }
 #endif
+
+#endif