Project

General

Profile

Feature #13552 » 0001-thread_sync.c-rename-mutex_waiter-struct-to-sync_wai.patch

normalperson (Eric Wong), 05/10/2017 12:16 AM

View differences:

thread_sync.c
/* Mutex */
/* mutex_waiter is always on-stack */
struct mutex_waiter {
/* sync_waiter is always on-stack */
struct sync_waiter {
rb_thread_t *th;
struct list_node node;
};
......
static size_t
rb_mutex_num_waiting(rb_mutex_t *mutex)
{
struct mutex_waiter *w;
struct sync_waiter *w;
size_t n = 0;
list_for_each(&mutex->waitq, w, node) {
......
}
if (rb_mutex_trylock(self) == Qfalse) {
struct mutex_waiter w;
struct sync_waiter w;
if (mutex->th == th) {
rb_raise(rb_eThreadError, "deadlock; recursive locking");
......
else if (mutex->th != th) {
err = "Attempt to unlock a mutex which is locked by another thread";
} else {
struct mutex_waiter *cur = 0, *next = 0;
struct sync_waiter *cur = 0, *next = 0;
rb_mutex_t *volatile *th_mutex = &th->keeping_mutexes;
mutex->th = 0;
-
(1-1/2)