X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e3d4520d56f2d11ff8c384d9adbb2e8ab1068f78..e7dbf98c9905d9281223f93d53b0038cc6ea9a1e:/src/sthread/sthread.h diff --git a/src/sthread/sthread.h b/src/sthread/sthread.h index 1af86186cd..65279685e6 100644 --- a/src/sthread/sthread.h +++ b/src/sthread/sthread.h @@ -1,3 +1,8 @@ +/* Copyright (c) 2002-2023. The SimGrid Team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + /* SimGrid's pthread interposer. Intercepts most of the pthread and semaphore calls to model-check them. * * Intercepting on pthread is somewhat complicated by the fact that pthread is used everywhere in the system headers. @@ -10,14 +15,9 @@ #ifndef SIMGRID_STHREAD_H #define SIMGRID_STHREAD_H +#include "xbt/base.h" #include -#if defined(__ELF__) -#define XBT_PUBLIC __attribute__((visibility("default"))) -#else -#define XBT_PUBLIC -#endif - #if defined(__cplusplus) extern "C" { #endif @@ -40,11 +40,24 @@ 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, struct timezone* tz); +typedef struct { + void* sem; +} sthread_sem_t; +int sthread_sem_init(sthread_sem_t* sem, int pshared, unsigned int value); +int sthread_sem_destroy(sthread_sem_t* sem); +int sthread_sem_post(sthread_sem_t* sem); +int sthread_sem_wait(sthread_sem_t* sem); +int sthread_sem_trywait(sthread_sem_t* sem); +int sthread_sem_timedwait(sthread_sem_t* sem, const struct timespec* abs_timeout); + +int sthread_gettimeofday(struct timeval* tv); void sthread_sleep(double seconds); +int sthread_access_begin(void* objaddr, const char* objname, const char* file, int line); +void sthread_access_end(void* objaddr, const char* objname, const char* file, int line); + #if defined(__cplusplus) } #endif -#endif \ No newline at end of file +#endif