Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Typedefs | Functions
thread_sync.c File Reference
`#include "ccan/list/list.h"`

Go to the source code of this file.

## Data Structures
struct | sync_waiter
struct | rb_mutex_struct
struct | queue_waiter
struct | rb_condvar
struct | sleep_call

## Macros
#define | MUTEX_ALLOW_TRAP FL_USER1
#define | mutex_mark NULL
#define | queue_waitq(q) UNALIGNED_MEMBER_PTR(q, waitq)
#define | szqueue_waitq(sq) UNALIGNED_MEMBER_PTR(sq, q.waitq)
#define | szqueue_pushq(sq) UNALIGNED_MEMBER_PTR(sq, pushq)
#define | QUEUE_CLOSED FL_USER5
#define | DEFINE_CLASS(name, super) rb_c##name = define_thread_class(rb_cThread, #name, rb_c##super)

## Typedefs
typedef struct rb_mutex_struct | rb_mutex_t

## Functions
VALUE | rb_obj_is_mutex (VALUE obj)
VALUE | rb_mutex_new (void)
VALUE | rb_mutex_locked_p (VALUE self)
VALUE | rb_mutex_trylock (VALUE self)
VALUE | rb_mutex_lock (VALUE self)
VALUE | rb_mutex_owned_p (VALUE self)
VALUE | rb_mutex_unlock (VALUE self)
VALUE | rb_mutex_sleep (VALUE self, VALUE timeout)
VALUE | rb_mutex_synchronize (VALUE mutex, VALUE(*func)(VALUE arg), VALUE arg)
void | rb_mutex_allow_trap (VALUE self, int val)
| PACKED_STRUCT_UNALIGNED (struct rb_queue { struct list_head waitq;rb_serial_t fork_gen;const VALUE que;int num_waiting;})
| PACKED_STRUCT_UNALIGNED (struct rb_szqueue { struct rb_queue q;int num_waiting_push;struct list_head pushq;long max;})
| NORETURN (static void raise_closed_queue_error(VALUE self))

## Macro Definition Documentation

## ◆ DEFINE_CLASS

#define DEFINE_CLASS | ( |  | name,
|  |  | super
| ) |  | rb_c##name = define_thread_class(rb_cThread, #name, rb_c##super)

## ◆ MUTEX_ALLOW_TRAP

#define MUTEX_ALLOW_TRAP FL_USER1

Definition at line 13 of file thread_sync.c.

## ◆ mutex_mark

#define mutex_mark NULL

Definition at line 81 of file thread_sync.c.

## ◆ QUEUE_CLOSED

#define QUEUE_CLOSED FL_USER5

Definition at line 632 of file thread_sync.c.

## ◆ queue_waitq

#define queue_waitq | ( |  | q | ) | UNALIGNED_MEMBER_PTR(q, waitq)

Definition at line 557 of file thread_sync.c.

## ◆ szqueue_pushq

#define szqueue_pushq | ( |  | sq | ) | UNALIGNED_MEMBER_PTR(sq, pushq)

Definition at line 566 of file thread_sync.c.

## ◆ szqueue_waitq

#define szqueue_waitq | ( |  | sq | ) | UNALIGNED_MEMBER_PTR(sq, q.waitq)

Definition at line 565 of file thread_sync.c.

## Typedef Documentation

## ◆ rb_mutex_t

typedef struct rb_mutex_struct rb_mutex_t

## Function Documentation

## ◆ NORETURN()

NORETURN | ( | static void | raise_closed_queue_errorVALUE self | ) |

## ◆ PACKED_STRUCT_UNALIGNED() [1/2]

PACKED_STRUCT_UNALIGNED | ( | struct rb_queue { struct list_head waitq;rb_serial_t fork_gen;const VALUE que;int num_waiting;} |  | ) |

## ◆ PACKED_STRUCT_UNALIGNED() [2/2]

PACKED_STRUCT_UNALIGNED | ( | struct rb_szqueue { struct rb_queue q;int num_waiting_push;struct list_head pushq;long max;} |  | ) |

## ◆ rb_mutex_allow_trap()

void rb_mutex_allow_trap | ( | VALUE | self,
|  | int | val
| ) |  |

Definition at line 545 of file thread_sync.c.

References Check_TypedStruct.

## ◆ rb_mutex_lock()

VALUE rb_mutex_lock | ( | VALUE | self | ) |

Definition at line 333 of file thread_sync.c.

Referenced by rb_mutex_synchronize().

## ◆ rb_mutex_locked_p()

VALUE rb_mutex_locked_p | ( | VALUE | self | ) |

Definition at line 177 of file thread_sync.c.

## ◆ rb_mutex_new()

VALUE rb_mutex_new | ( | void |  | ) |

Definition at line 165 of file thread_sync.c.

## ◆ rb_mutex_owned_p()

VALUE rb_mutex_owned_p | ( | VALUE | self | ) |

Definition at line 345 of file thread_sync.c.

References GET_THREAD, and sync_waiter::th.

## ◆ rb_mutex_sleep()

VALUE rb_mutex_sleep | ( | VALUE | self,
|  | VALUE | timeout
| ) |  |

Definition at line 465 of file thread_sync.c.

References NIL_P, rb_ensure(), rb_mutex_unlock(), rb_time_interval(), and time().

## ◆ rb_mutex_synchronize()

VALUE rb_mutex_synchronize | ( | VALUE | mutex,
|  | VALUE(*)(VALUE arg) | func,
|  | VALUE | arg
| ) |  |

Definition at line 522 of file thread_sync.c.

References arg, rb_ensure(), rb_mutex_lock(), and rb_mutex_unlock().

## ◆ rb_mutex_trylock()

VALUE rb_mutex_trylock | ( | VALUE | self | ) |

Definition at line 203 of file thread_sync.c.

## ◆ rb_mutex_unlock()

VALUE rb_mutex_unlock | ( | VALUE | self | ) |

Definition at line 403 of file thread_sync.c.

References err.

Referenced by rb_mutex_sleep(), and rb_mutex_synchronize().

## ◆ rb_obj_is_mutex()

VALUE rb_obj_is_mutex | ( | VALUE | obj | ) |

Definition at line 131 of file thread_sync.c.

References obj, and rb_typeddata_is_kind_of().