1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

thread_sync.c: remove "volatile" qualifiers

I may store ->ec in rb_mutex_t instead of ->th to support green
thread.  For now, "volatile" is useless for thread-safety
anyways and we're not dealing with *jmp or signals with mutex.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2018-04-28 06:23:43 +00:00
parent 0d77b73db7
commit b6e2851431

View file

@ -45,7 +45,7 @@ wakeup_all(struct list_head *head)
/* Mutex */ /* Mutex */
typedef struct rb_mutex_struct { typedef struct rb_mutex_struct {
struct rb_thread_struct volatile *th; rb_thread_t *th;
struct rb_mutex_struct *next_mutex; struct rb_mutex_struct *next_mutex;
struct list_head waitq; /* protected by GVL */ struct list_head waitq; /* protected by GVL */
} rb_mutex_t; } rb_mutex_t;
@ -55,7 +55,7 @@ static void rb_mutex_abandon_all(rb_mutex_t *mutexes);
static void rb_mutex_abandon_keeping_mutexes(rb_thread_t *th); static void rb_mutex_abandon_keeping_mutexes(rb_thread_t *th);
static void rb_mutex_abandon_locking_mutex(rb_thread_t *th); static void rb_mutex_abandon_locking_mutex(rb_thread_t *th);
#endif #endif
static const char* rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t volatile *th); static const char* rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t *th);
/* /*
* Document-class: Mutex * Document-class: Mutex
@ -318,7 +318,7 @@ rb_mutex_owned_p(VALUE self)
} }
static const char * static const char *
rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t volatile *th) rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t *th)
{ {
const char *err = NULL; const char *err = NULL;
@ -330,7 +330,7 @@ rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t volatile *th)
} }
else { else {
struct sync_waiter *cur = 0, *next = 0; struct sync_waiter *cur = 0, *next = 0;
rb_mutex_t *volatile *th_mutex = &th->keeping_mutexes; rb_mutex_t **th_mutex = &th->keeping_mutexes;
mutex->th = 0; mutex->th = 0;
list_for_each_safe(&mutex->waitq, cur, next, node) { list_for_each_safe(&mutex->waitq, cur, next, node) {