CUBRID Engine  latest
critical_section.h File Reference
#include "dbtype_def.h"
#include "porting.h"
#include "thread_compat.hpp"
#include <pthread.h>
#include <sys/time.h>
Include dependency graph for critical_section.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sync_stats
 
struct  sync_critical_section
 
struct  sync_rwlock
 
struct  sync_rmutex
 

Macros

#define csect_initialize_critical_section(a, b)
 
#define csect_finalize_critical_section(a)
 
#define csect_enter(a, b, c)   NO_ERROR
 
#define csect_enter_as_reader(a, b, c)   NO_ERROR
 
#define csect_exit(a, b)
 
#define csect_enter_critical_section(a, b, c)
 
#define csect_enter_critical_section_as_reader(a, b, c)
 
#define csect_exit_critical_section(a, b)
 
#define csect_check_own(a, b)   1
 
#define csect_start_scan   NULL
 
#define rwlock_initialize(a, b)   NO_ERROR
 
#define rwlock_finalize(a)   NO_ERROR
 
#define rwlock_read_lock(a)   NO_ERROR
 
#define rwlock_read_unlock(a)   NO_ERROR
 
#define rwlock_write_lock(a)   NO_ERROR
 
#define rwlock_write_unlock(a)   NO_ERROR
 
#define rmutex_initialize(a, b)   NO_ERROR
 
#define rmutex_finalize(a)   NO_ERROR
 
#define rmutex_lock(a, b)   NO_ERROR
 
#define rmutex_unlock(a, b)   NO_ERROR
 

Typedefs

typedef struct sync_stats SYNC_STATS
 
typedef struct sync_critical_section SYNC_CRITICAL_SECTION
 
typedef struct sync_rwlock SYNC_RWLOCK
 
typedef struct sync_rmutex SYNC_RMUTEX
 

Enumerations

enum  { INF_WAIT = -1, NOT_WAIT = 0 }
 
enum  {
  CSECT_WFG = 0, CSECT_LOG, CSECT_LOCATOR_SR_CLASSNAME_TABLE, CSECT_QPROC_QUERY_TABLE,
  CSECT_QPROC_LIST_CACHE, CSECT_DISK_CHECK, CSECT_CNV_FMT_LEXER, CSECT_HEAP_CHNGUESS,
  CSECT_TRAN_TABLE, CSECT_CT_OID_TABLE, CSECT_HA_SERVER_STATE, CSECT_COMPACTDB_ONE_INSTANCE,
  CSECT_ACL, CSECT_PARTITION_CACHE, CSECT_EVENT_LOG_FILE, CSECT_LOG_ARCHIVE,
  CSECT_ACCESS_STATUS, CSECT_LAST
}
 
enum  SYNC_PRIMITIVE_TYPE {
  SYNC_TYPE_NONE, SYNC_TYPE_CSECT, SYNC_TYPE_RWLOCK, SYNC_TYPE_RMUTEX,
  SYNC_TYPE_MUTEX, SYNC_TYPE_LAST = SYNC_TYPE_MUTEX, SYNC_TYPE_COUNT = SYNC_TYPE_LAST, SYNC_TYPE_ALL = SYNC_TYPE_LAST
}
 

Functions

int csect_initialize_static_critical_sections (void)
 
int csect_finalize_static_critical_sections (void)
 
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_demote (THREAD_ENTRY *thread_p, int cs_index, int wait_secs)
 
int csect_promote (THREAD_ENTRY *thread_p, int cs_index, int wait_secs)
 
int csect_exit (THREAD_ENTRY *thread_p, int cs_index)
 
static const char * csect_name_at (int cs_index)
 
int csect_initialize_critical_section (SYNC_CRITICAL_SECTION *cs_ptr, const char *name)
 
int csect_finalize_critical_section (SYNC_CRITICAL_SECTION *cs_ptr)
 
int csect_enter_critical_section (THREAD_ENTRY *thread_p, SYNC_CRITICAL_SECTION *cs_ptr, int wait_secs)
 
int csect_enter_critical_section_as_reader (THREAD_ENTRY *thread_p, SYNC_CRITICAL_SECTION *cs_ptr, int wait_secs)
 
int csect_exit_critical_section (THREAD_ENTRY *thread_p, SYNC_CRITICAL_SECTION *cs_ptr)
 
int csect_check_own (THREAD_ENTRY *thread_p, int cs_index)
 
void csect_dump_statistics (FILE *fp)
 
int csect_start_scan (THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ctx)
 
int rwlock_initialize (SYNC_RWLOCK *rwlock, const char *name)
 
int rwlock_finalize (SYNC_RWLOCK *rwlock)
 
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)
 
int sync_initialize_sync_stats (void)
 
int sync_finalize_sync_stats (void)
 
void rwlock_dump_statistics (FILE *fp)
 
int rmutex_initialize (SYNC_RMUTEX *rmutex, const char *name)
 
int rmutex_finalize (SYNC_RMUTEX *rmutex)
 
int rmutex_lock (THREAD_ENTRY *thread_p, SYNC_RMUTEX *rmutex)
 
int rmutex_unlock (THREAD_ENTRY *thread_p, SYNC_RMUTEX *rmutex)
 
void rmutex_dump_statistics (FILE *fp)
 
void sync_dump_statistics (FILE *fp, SYNC_PRIMITIVE_TYPE type)
 

Variables

static const int CRITICAL_SECTION_COUNT = STATIC_CAST (int, CSECT_LAST)
 

Macro Definition Documentation

#define csect_enter (   a,
  b,
 
)    NO_ERROR

Definition at line 201 of file critical_section.h.

#define csect_enter_critical_section (   a,
  b,
 
)

Definition at line 204 of file critical_section.h.

Referenced by csect_name_at().

#define csect_enter_critical_section_as_reader (   a,
  b,
 
)

Definition at line 205 of file critical_section.h.

Referenced by csect_name_at().

#define csect_exit (   a,
 
)

Definition at line 203 of file critical_section.h.

#define csect_exit_critical_section (   a,
 
)

Definition at line 206 of file critical_section.h.

Referenced by csect_name_at().

#define csect_finalize_critical_section (   a)

Definition at line 200 of file critical_section.h.

Referenced by csect_name_at().

#define csect_initialize_critical_section (   a,
 
)

Definition at line 199 of file critical_section.h.

Referenced by csect_name_at().

#define csect_start_scan   NULL

Definition at line 208 of file critical_section.h.

Referenced by csect_name_at(), and showstmt_scan_init().

#define rmutex_finalize (   a)    NO_ERROR
#define rmutex_initialize (   a,
 
)    NO_ERROR
#define rwlock_finalize (   a)    NO_ERROR

Definition at line 211 of file critical_section.h.

Referenced by csect_name_at(), css_final_conn_list(), and css_init_conn_list().

#define rwlock_initialize (   a,
 
)    NO_ERROR

Definition at line 210 of file critical_section.h.

Referenced by csect_name_at(), and css_init_conn_list().

#define rwlock_read_lock (   a)    NO_ERROR

Definition at line 212 of file critical_section.h.

Referenced by csect_name_at().

#define rwlock_read_unlock (   a)    NO_ERROR

Definition at line 213 of file critical_section.h.

Referenced by csect_name_at().

#define rwlock_write_lock (   a)    NO_ERROR

Definition at line 214 of file critical_section.h.

Referenced by csect_name_at().

#define rwlock_write_unlock (   a)    NO_ERROR

Definition at line 215 of file critical_section.h.

Referenced by csect_name_at().

Typedef Documentation

typedef struct sync_rmutex SYNC_RMUTEX
typedef struct sync_rwlock SYNC_RWLOCK
typedef struct sync_stats SYNC_STATS

Enumeration Type Documentation

anonymous enum
Enumerator
INF_WAIT 
NOT_WAIT 

Definition at line 47 of file critical_section.h.

anonymous enum
Enumerator
CSECT_WFG 
CSECT_LOG 
CSECT_LOCATOR_SR_CLASSNAME_TABLE 
CSECT_QPROC_QUERY_TABLE 
CSECT_QPROC_LIST_CACHE 
CSECT_DISK_CHECK 
CSECT_CNV_FMT_LEXER 
CSECT_HEAP_CHNGUESS 
CSECT_TRAN_TABLE 
CSECT_CT_OID_TABLE 
CSECT_HA_SERVER_STATE 
CSECT_COMPACTDB_ONE_INSTANCE 
CSECT_ACL 
CSECT_PARTITION_CACHE 
CSECT_EVENT_LOG_FILE 
CSECT_LOG_ARCHIVE 
CSECT_ACCESS_STATUS 
CSECT_LAST 

Definition at line 57 of file critical_section.h.

Enumerator
SYNC_TYPE_NONE 
SYNC_TYPE_CSECT 
SYNC_TYPE_RWLOCK 
SYNC_TYPE_RMUTEX 
SYNC_TYPE_MUTEX 
SYNC_TYPE_LAST 
SYNC_TYPE_COUNT 
SYNC_TYPE_ALL 

Definition at line 82 of file critical_section.h.

Function Documentation

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

Definition at line 1147 of file critical_section.c.

References assert, CRITICAL_SECTION_COUNT, and csect_demote_critical_section().

Referenced by LOG_CS_DEMOTE().

Here is the caller graph for this function:

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_exit ( THREAD_ENTRY thread_p,
int  cs_index 
)
int csect_finalize_static_critical_sections ( void  )

Definition at line 266 of file critical_section.c.

References assert, CRITICAL_SECTION_COUNT, sync_critical_section::cs_index, csect_finalize_critical_section(), i, and NO_ERROR.

Referenced by net_server_start().

Here is the caller graph for this function:

int csect_initialize_static_critical_sections ( void  )

Definition at line 240 of file critical_section.c.

References CRITICAL_SECTION_COUNT, sync_critical_section::cs_index, csect_initialize_critical_section(), csect_Names, i, and NO_ERROR.

Referenced by net_server_start().

Here is the caller graph for this function:

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

Definition at line 1356 of file critical_section.c.

References assert, CRITICAL_SECTION_COUNT, and csect_promote_critical_section().

Referenced by LOG_CS_PROMOTE().

Here is the caller graph for this function:

void sync_dump_statistics ( FILE *  fp,
SYNC_PRIMITIVE_TYPE  type 
)
int sync_finalize_sync_stats ( void  )
int sync_initialize_sync_stats ( void  )

Variable Documentation