Skip to content

File critical_section.c

FileList > cubrid > src > thread > critical_section.c

Go to the source code of this file

  • #include "critical_section.h"
  • #include "connection_defs.h"
  • #include "connection_error.h"
  • #include "config.h"
  • #include "critical_section_tracker.hpp"
  • #include "dbtype.h"
  • #include "numeric_opfunc.h"
  • #include "perf_monitor.h"
  • #include "porting.h"
  • #include "resource_tracker.hpp"
  • #include "show_scan.h"
  • #include "system_parameter.h"
  • #include "thread_entry.hpp"
  • #include "thread_manager.hpp"
  • #include "tsc_timer.h"
  • #include <stdio.h>
  • #include <assert.h>
  • #include "memory_wrapper.hpp"

Classes

Type Name
struct sync_stats_chunk

Public Types

Type Name
typedef struct sync_stats_chunk SYNC_STATS_CHUNK

Public Attributes

Type Name
SYNC_CRITICAL_SECTION csectgl_Critical_sections
SYNC_STATS_CHUNK sync_Stats
pthread_mutex_t sync_Stats_lock

Public Static Attributes

Type Name
const char * csect_Names = /* multi line expression */

Public Functions

Type Name
int csect_check_own (THREAD_ENTRY * thread_p, int cs_index)
int csect_demote (THREAD_ENTRY * thread_p, int cs_index, int wait_secs)
void csect_dump_statistics (FILE * fp)
int csect_enter (THREAD_ENTRY * thread_p, int cs_index, int wait_secs)
int csect_enter_as_reader (THREAD_ENTRY * thread_p, int cs_index, int wait_secs)
int csect_enter_critical_section (THREAD_ENTRY * thread_p, SYNC_CRITICAL_SECTION * csect, int wait_secs)
int csect_enter_critical_section_as_reader (THREAD_ENTRY * thread_p, SYNC_CRITICAL_SECTION * csect, int wait_secs)
int csect_exit (THREAD_ENTRY * thread_p, int cs_index)
int csect_exit_critical_section (THREAD_ENTRY * thread_p, SYNC_CRITICAL_SECTION * csect)
int csect_finalize_critical_section (SYNC_CRITICAL_SECTION * csect)
int csect_finalize_static_critical_sections (void)
int csect_initialize_critical_section (SYNC_CRITICAL_SECTION * csect, const char * name)
int csect_initialize_static_critical_sections (void)
const char * csect_name_at (int cs_index)
int csect_promote (THREAD_ENTRY * thread_p, int cs_index, int wait_secs)
int csect_start_scan (THREAD_ENTRY * thread_p, int show_type, DB_VALUE ** arg_values, int arg_cnt, void ** ptr)
void rmutex_dump_statistics (FILE * fp)
int rmutex_finalize (SYNC_RMUTEX * rmutex)
int rmutex_initialize (SYNC_RMUTEX * rmutex, const char * name)
int rmutex_lock (THREAD_ENTRY * thread_p, SYNC_RMUTEX * rmutex)
int rmutex_unlock (THREAD_ENTRY * thread_p, SYNC_RMUTEX * rmutex)
void rwlock_dump_statistics (FILE * fp)
int rwlock_finalize (SYNC_RWLOCK * rwlock)
int rwlock_initialize (SYNC_RWLOCK * rwlock, const char * name)
int rwlock_read_lock (SYNC_RWLOCK * rwlock)
int rwlock_read_unlock (SYNC_RWLOCK * rwlock)
int rwlock_write_lock (SYNC_RWLOCK * rwlock)
int rwlock_write_unlock (SYNC_RWLOCK * rwlock)
void sync_dump_statistics (FILE * fp, SYNC_PRIMITIVE_TYPE type)
int sync_finalize_sync_stats (void)
int sync_initialize_sync_stats (void)

Public Static Functions

Type Name
int csect_check_own_critical_section (THREAD_ENTRY * thread_p, SYNC_CRITICAL_SECTION * csect)
int csect_demote_critical_section (THREAD_ENTRY * thread_p, SYNC_CRITICAL_SECTION * csect, int wait_secs)
const char * csect_name (SYNC_CRITICAL_SECTION * c)
int csect_promote_critical_section (THREAD_ENTRY * thread_p, SYNC_CRITICAL_SECTION * csect, int wait_secs)
int csect_wait_on_promoter_queue (THREAD_ENTRY * thread_p, SYNC_CRITICAL_SECTION * csect, int timeout, struct timespec * to)
int csect_wait_on_writer_queue (THREAD_ENTRY * thread_p, SYNC_CRITICAL_SECTION * csect, int timeout, struct timespec * to)
int csect_wakeup_waiting_promoter (SYNC_CRITICAL_SECTION * csect)
int csect_wakeup_waiting_writer (SYNC_CRITICAL_SECTION * csect)
SYNC_STATS * sync_allocate_sync_stats (SYNC_PRIMITIVE_TYPE sync_prim_type, const char * name)
SYNC_STATS_CHUNK * sync_allocate_sync_stats_chunk (void)
SYNC_STATS * sync_consume_sync_stats_from_pool (SYNC_STATS_CHUNK * sync_stats_chunk, int idx, SYNC_PRIMITIVE_TYPE sync_prim_type, const char * name)
int sync_deallocate_sync_stats (SYNC_STATS * stats)
int sync_initialize_sync_stats_chunk (SYNC_STATS_CHUNK * sync_stats_chunk)
void sync_reset_stats_metrics (SYNC_STATS * stats)
int sync_return_sync_stats_to_pool (SYNC_STATS_CHUNK * sync_stats_chunk, int idx)

Macros

Type Name
define NUM_ENTRIES_OF_SYNC_STATS_BLOCK 256
define TOTAL_AND_MAX_TIMEVAL (total, max, elapsed) /* multi line expression */

Public Types Documentation

typedef SYNC_STATS_CHUNK

typedef struct sync_stats_chunk SYNC_STATS_CHUNK;

Public Attributes Documentation

variable csectgl_Critical_sections

SYNC_CRITICAL_SECTION csectgl_Critical_sections[CRITICAL_SECTION_COUNT];

variable sync_Stats

SYNC_STATS_CHUNK sync_Stats;

variable sync_Stats_lock

pthread_mutex_t sync_Stats_lock;

Public Static Attributes Documentation

variable csect_Names

const char* csect_Names[];

Public Functions Documentation

function csect_check_own

int csect_check_own (
    THREAD_ENTRY * thread_p,
    int cs_index
) 

function csect_demote

int csect_demote (
    THREAD_ENTRY * thread_p,
    int cs_index,
    int wait_secs
) 

function csect_dump_statistics

void csect_dump_statistics (
    FILE * fp
) 

function csect_enter

int csect_enter (
    THREAD_ENTRY * thread_p,
    int cs_index,
    int wait_secs
) 

function csect_enter_as_reader

int csect_enter_as_reader (
    THREAD_ENTRY * thread_p,
    int cs_index,
    int wait_secs
) 

function csect_enter_critical_section

int csect_enter_critical_section (
    THREAD_ENTRY * thread_p,
    SYNC_CRITICAL_SECTION * csect,
    int wait_secs
) 

function csect_enter_critical_section_as_reader

int csect_enter_critical_section_as_reader (
    THREAD_ENTRY * thread_p,
    SYNC_CRITICAL_SECTION * csect,
    int wait_secs
) 

function csect_exit

int csect_exit (
    THREAD_ENTRY * thread_p,
    int cs_index
) 

function csect_exit_critical_section

int csect_exit_critical_section (
    THREAD_ENTRY * thread_p,
    SYNC_CRITICAL_SECTION * csect
) 

function csect_finalize_critical_section

int csect_finalize_critical_section (
    SYNC_CRITICAL_SECTION * csect
) 

function csect_finalize_static_critical_sections

int csect_finalize_static_critical_sections (
    void
) 

function csect_initialize_critical_section

int csect_initialize_critical_section (
    SYNC_CRITICAL_SECTION * csect,
    const  char * name
) 

function csect_initialize_static_critical_sections

int csect_initialize_static_critical_sections (
    void
) 

function csect_name_at

const  char * csect_name_at (
    int cs_index
) 

function csect_promote

int csect_promote (
    THREAD_ENTRY * thread_p,
    int cs_index,
    int wait_secs
) 

function csect_start_scan

int csect_start_scan (
    THREAD_ENTRY * thread_p,
    int show_type,
    DB_VALUE ** arg_values,
    int arg_cnt,
    void ** ptr
) 

function rmutex_dump_statistics

void rmutex_dump_statistics (
    FILE * fp
) 

function rmutex_finalize

int rmutex_finalize (
    SYNC_RMUTEX * rmutex
) 

function rmutex_initialize

int rmutex_initialize (
    SYNC_RMUTEX * rmutex,
    const  char * name
) 

function rmutex_lock

int rmutex_lock (
    THREAD_ENTRY * thread_p,
    SYNC_RMUTEX * rmutex
) 

function rmutex_unlock

int rmutex_unlock (
    THREAD_ENTRY * thread_p,
    SYNC_RMUTEX * rmutex
) 

function rwlock_dump_statistics

void rwlock_dump_statistics (
    FILE * fp
) 

function rwlock_finalize

int rwlock_finalize (
    SYNC_RWLOCK * rwlock
) 

function rwlock_initialize

int rwlock_initialize (
    SYNC_RWLOCK * rwlock,
    const  char * name
) 

function rwlock_read_lock

int rwlock_read_lock (
    SYNC_RWLOCK * rwlock
) 

function rwlock_read_unlock

int rwlock_read_unlock (
    SYNC_RWLOCK * rwlock
) 

function rwlock_write_lock

int rwlock_write_lock (
    SYNC_RWLOCK * rwlock
) 

function rwlock_write_unlock

int rwlock_write_unlock (
    SYNC_RWLOCK * rwlock
) 

function sync_dump_statistics

void sync_dump_statistics (
    FILE * fp,
    SYNC_PRIMITIVE_TYPE type
) 

function sync_finalize_sync_stats

int sync_finalize_sync_stats (
    void
) 

function sync_initialize_sync_stats

int sync_initialize_sync_stats (
    void
) 

Public Static Functions Documentation

function csect_check_own_critical_section

static int csect_check_own_critical_section (
    THREAD_ENTRY * thread_p,
    SYNC_CRITICAL_SECTION * csect
) 

function csect_demote_critical_section

static int csect_demote_critical_section (
    THREAD_ENTRY * thread_p,
    SYNC_CRITICAL_SECTION * csect,
    int wait_secs
) 

function csect_name

static const  char * csect_name (
    SYNC_CRITICAL_SECTION * c
) 

function csect_promote_critical_section

static int csect_promote_critical_section (
    THREAD_ENTRY * thread_p,
    SYNC_CRITICAL_SECTION * csect,
    int wait_secs
) 

function csect_wait_on_promoter_queue

static int csect_wait_on_promoter_queue (
    THREAD_ENTRY * thread_p,
    SYNC_CRITICAL_SECTION * csect,
    int timeout,
    struct  timespec * to
) 

function csect_wait_on_writer_queue

static int csect_wait_on_writer_queue (
    THREAD_ENTRY * thread_p,
    SYNC_CRITICAL_SECTION * csect,
    int timeout,
    struct  timespec * to
) 

function csect_wakeup_waiting_promoter

static int csect_wakeup_waiting_promoter (
    SYNC_CRITICAL_SECTION * csect
) 

function csect_wakeup_waiting_writer

static int csect_wakeup_waiting_writer (
    SYNC_CRITICAL_SECTION * csect
) 

function sync_allocate_sync_stats

static SYNC_STATS * sync_allocate_sync_stats (
    SYNC_PRIMITIVE_TYPE sync_prim_type,
    const  char * name
) 

function sync_allocate_sync_stats_chunk

static SYNC_STATS_CHUNK * sync_allocate_sync_stats_chunk (
    void
) 

function sync_consume_sync_stats_from_pool

static SYNC_STATS * sync_consume_sync_stats_from_pool (
    SYNC_STATS_CHUNK * sync_stats_chunk,
    int idx,
    SYNC_PRIMITIVE_TYPE sync_prim_type,
    const  char * name
) 

function sync_deallocate_sync_stats

static int sync_deallocate_sync_stats (
    SYNC_STATS * stats
) 

function sync_initialize_sync_stats_chunk

static int sync_initialize_sync_stats_chunk (
    SYNC_STATS_CHUNK * sync_stats_chunk
) 

function sync_reset_stats_metrics

static void sync_reset_stats_metrics (
    SYNC_STATS * stats
) 

function sync_return_sync_stats_to_pool

static int sync_return_sync_stats_to_pool (
    SYNC_STATS_CHUNK * sync_stats_chunk,
    int idx
) 

Macro Definition Documentation

define NUM_ENTRIES_OF_SYNC_STATS_BLOCK

#define NUM_ENTRIES_OF_SYNC_STATS_BLOCK `256`

define TOTAL_AND_MAX_TIMEVAL

#define TOTAL_AND_MAX_TIMEVAL (
    total,
    max,
    elapsed
) `/* multi line expression */`


The documentation for this class was generated from the following file cubrid/src/thread/critical_section.c