1 /* Copyright (c) 2012, 2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #ifndef _SIMIX_SYNCHRO_PRIVATE_H
8 #define _SIMIX_SYNCHRO_PRIVATE_H
11 #include "xbt/xbt_os_thread.h"
13 typedef struct s_smx_mutex {
16 xbt_swag_t sleeping; /* list of sleeping process */
19 typedef struct s_smx_cond {
21 xbt_swag_t sleeping; /* list of sleeping process */
24 typedef struct s_smx_sem {
26 xbt_swag_t sleeping; /* list of sleeping process */
29 void SIMIX_post_synchro(smx_synchro_t synchro);
30 void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t simcall);
31 void SIMIX_synchro_destroy(smx_synchro_t synchro);
33 smx_mutex_t SIMIX_mutex_init(void);
34 void SIMIX_mutex_destroy(smx_mutex_t mutex);
35 int SIMIX_mutex_trylock(smx_mutex_t mutex, smx_process_t issuer);
36 void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer);
38 smx_cond_t SIMIX_cond_init(void);
39 void SIMIX_cond_destroy(smx_cond_t cond);
40 void SIMIX_cond_signal(smx_cond_t cond);
41 void SIMIX_cond_broadcast(smx_cond_t cond);
43 smx_sem_t SIMIX_sem_init(unsigned int value);
44 void SIMIX_sem_destroy(smx_sem_t sem);
45 void SIMIX_sem_release(smx_sem_t sem);
46 int SIMIX_sem_would_block(smx_sem_t sem);
47 int SIMIX_sem_get_capacity(smx_sem_t sem);