Bug in communication techniques bench
* prod_idx and cons_idx aren't declared volatile so compiler could sur-optimize access to these variable and lead to a deadlock
This commit is contained in:
parent
471fdef61e
commit
02db9b77f6
|
@ -14,8 +14,8 @@ struct communication_assoc
|
|||
struct communication_assoc *prev;
|
||||
pthread_t tid;
|
||||
uintptr_t *shared_space;
|
||||
int *cons_idx;
|
||||
int *prod_idx;
|
||||
volatile int *cons_idx;
|
||||
volatile int *prod_idx;
|
||||
};
|
||||
|
||||
extern struct communication_assoc assoc_root;
|
||||
|
@ -23,8 +23,8 @@ extern struct communication_assoc assoc_root;
|
|||
__BEGIN_DECLS
|
||||
|
||||
extern __thread uintptr_t *shared_space;
|
||||
extern __thread int prod_idx;
|
||||
extern __thread int cons_idx;
|
||||
extern __thread volatile int prod_idx;
|
||||
extern __thread volatile int cons_idx;
|
||||
|
||||
struct communication_assoc *create_comm_assoc(void);
|
||||
static inline void send(uintptr_t value) {
|
||||
|
|
|
@ -14,8 +14,8 @@ struct communication_assoc
|
|||
struct communication_assoc *prev;
|
||||
pthread_t tid;
|
||||
uintptr_t *shared_space;
|
||||
int *cons_idx;
|
||||
int *prod_idx;
|
||||
volatile int *cons_idx;
|
||||
volatile int *prod_idx;
|
||||
};
|
||||
|
||||
extern struct communication_assoc assoc_root;
|
||||
|
@ -23,8 +23,8 @@ extern struct communication_assoc assoc_root;
|
|||
__BEGIN_DECLS
|
||||
|
||||
extern __thread uintptr_t *shared_space;
|
||||
extern __thread int prod_idx;
|
||||
extern __thread int cons_idx;
|
||||
extern __thread volatile int prod_idx;
|
||||
extern __thread volatile int cons_idx;
|
||||
|
||||
struct communication_assoc *create_comm_assoc(void);
|
||||
static inline void send(uintptr_t value) {
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
|
||||
__thread uintptr_t *shared_space;
|
||||
__thread int cons_idx = 0;
|
||||
__thread int prod_idx = 0;
|
||||
__thread volatile int cons_idx = 0;
|
||||
__thread volatile int prod_idx = 0;
|
||||
|
||||
struct communication_assoc *create_comm_assoc(void)
|
||||
{
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
|
||||
__thread uintptr_t *shared_space;
|
||||
__thread int cons_idx = 0;
|
||||
__thread int prod_idx = 0;
|
||||
__thread volatile int cons_idx = 0;
|
||||
__thread volatile int prod_idx = 0;
|
||||
|
||||
struct communication_assoc *create_comm_assoc(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue