Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / simix / smx_synchro_private.h
1 #ifndef _SIMIX_SYNCHRO_PRIVATE_H
2 #define _SIMIX_SYNCHRO_PRIVATE_H
3
4 #include "xbt/swag.h"
5 #include "xbt/xbt_os_thread.h"
6
7 typedef struct s_smx_mutex {
8   unsigned int locked;
9   smx_process_t owner;
10   xbt_swag_t sleeping;          /* list of sleeping process */
11 } s_smx_mutex_t;
12
13 typedef struct s_smx_cond {
14   smx_mutex_t mutex;
15   xbt_swag_t sleeping;          /* list of sleeping process */
16 } s_smx_cond_t;
17
18 typedef struct s_smx_sem {
19   unsigned int value;
20   xbt_swag_t sleeping;          /* list of sleeping process */
21 } s_smx_sem_t;
22
23 void SIMIX_post_synchro(smx_action_t action);
24 void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t simcall);
25 void SIMIX_synchro_destroy(smx_action_t action);
26
27 smx_mutex_t SIMIX_mutex_init(void);
28 void SIMIX_mutex_destroy(smx_mutex_t mutex);
29 void SIMIX_pre_mutex_lock(smx_simcall_t simcall);
30 int SIMIX_mutex_trylock(smx_mutex_t mutex, smx_process_t issuer);
31 void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer);
32
33 smx_cond_t SIMIX_cond_init(void);
34 void SIMIX_cond_destroy(smx_cond_t cond);
35 void SIMIX_cond_signal(smx_cond_t cond);
36 void SIMIX_pre_cond_wait(smx_simcall_t simcall);
37 void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall);
38 void SIMIX_cond_broadcast(smx_cond_t cond);
39
40 smx_sem_t SIMIX_sem_init(unsigned int value);
41 void SIMIX_sem_destroy(smx_sem_t sem);
42 void SIMIX_sem_release(smx_sem_t sem);
43 int SIMIX_sem_would_block(smx_sem_t sem);
44 void SIMIX_pre_sem_acquire(smx_simcall_t simcall);
45 void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall);
46 int SIMIX_sem_get_capacity(smx_sem_t sem);
47
48 #endif