Drizzled Public API Documentation

rw_lock_struct Struct Reference

#include <sync0rw.h>

List of all members.

Public Member Functions

 UT_LIST_NODE_T (rw_lock_t) list

Public Attributes

volatile lint lock_word
volatile ulint waiters
volatile ibool recursive
volatile os_thread_id_t writer_thread
os_event_t event
os_event_t wait_ex_event
mutex_t mutex
ulint count_os_wait
const char * cfile_name
const char * last_s_file_name
const char * last_x_file_name
ibool writer_is_wait_ex
unsigned cline:14
unsigned last_s_line:14
unsigned last_x_line:14

Detailed Description

The structure used in the spin lock implementation of a read-write lock. Several threads may have a shared lock simultaneously in this lock, but only one writer may have an exclusive lock, in which case no shared locks are allowed. To prevent starving of a writer blocked by readers, a writer may queue for x-lock by decrementing lock_word: no new readers will be let in while the thread waits for readers to exit.

Definition at line 571 of file sync0rw.h.


Member Function Documentation

rw_lock_struct::UT_LIST_NODE_T ( rw_lock_t  )

All allocated rw locks are put into a list


Member Data Documentation

File name where lock created

Definition at line 612 of file sync0rw.h.

Referenced by innodb_mutex_show_status(), rw_lock_create_func(), and rw_lock_x_lock_func().

Line where created

Definition at line 623 of file sync0rw.h.

Referenced by innodb_mutex_show_status(), and rw_lock_create_func().

Count of os_waits. May not be accurate

Definition at line 611 of file sync0rw.h.

Referenced by innodb_mutex_show_status(), rw_lock_create_func(), and rw_lock_x_lock_func().

Used by sync0arr.c for thread queueing

Definition at line 591 of file sync0rw.h.

Referenced by rw_lock_create_func(), and rw_lock_free_func().

File name where last s-locked

Definition at line 614 of file sync0rw.h.

Referenced by rw_lock_create_func().

Line number where last time s-locked

Definition at line 624 of file sync0rw.h.

Referenced by rw_lock_create_func().

File name where last x-locked

Definition at line 615 of file sync0rw.h.

Referenced by rw_lock_create_func().

Line number where last time x-locked

Definition at line 625 of file sync0rw.h.

Referenced by rw_lock_create_func().

Holds the state of the lock.

Definition at line 573 of file sync0rw.h.

Referenced by rw_lock_create_func(), rw_lock_free_func(), and rw_lock_x_lock_func().

The mutex protecting rw_lock_struct

Definition at line 596 of file sync0rw.h.

Referenced by rw_lock_create_func().

volatile ibool rw_lock_struct::recursive

Default value FALSE which means the lock is non-recursive. The value is typically set to TRUE making normal rw_locks recursive. In case of asynchronous IO, when a non-zero value of 'pass' is passed then we keep the lock non-recursive. This flag also tells us about the state of writer_thread field. If this flag is set then writer_thread MUST contain the thread id of the current x-holder or wait-x thread. This flag must be reset in x_unlock functions before incrementing the lock_word

Definition at line 575 of file sync0rw.h.

Referenced by rw_lock_create_func().

Event for next-writer to wait on. A thread must decrement lock_word before waiting.

Definition at line 593 of file sync0rw.h.

Referenced by rw_lock_create_func(), and rw_lock_free_func().

volatile ulint rw_lock_struct::waiters

1: there are waiters

Definition at line 574 of file sync0rw.h.

Referenced by rw_lock_create_func().

This is TRUE if the writer field is RW_LOCK_WAIT_EX; this field is located far from the memory update hotspot fields which are at the start of this struct, thus we can peek this field without causing much memory bus traffic

Definition at line 617 of file sync0rw.h.

Thread id of writer thread. Is only guaranteed to have sane and non-stale value iff recursive flag is set.

Definition at line 588 of file sync0rw.h.


The documentation for this struct was generated from the following file: