mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
2662b59306
Docs/manual.texi: Added Innobase documentation configure.in: Incremented version include/my_base.h: Added option for Innobase myisam/mi_check.c: cleanup mysql-test/t/bdb.test: cleanup mysql-test/t/innobase.test: Extended with new tests from bdb.test mysql-test/t/merge.test: Added test of SHOW create mysys/my_init.c: Fix for UNIXWARE 7 scripts/mysql_install_db.sh: Always write how to start mysqld scripts/safe_mysqld.sh: Fixed type sql/ha_innobase.cc: Update to new version sql/ha_innobase.h: Update to new version sql/handler.h: Added 'update_table_comment()' and 'append_create_info()' sql/sql_delete.cc: Fixes for Innobase sql/sql_select.cc: Fixes for Innobase sql/sql_show.cc: Append create information (for MERGE tables) sql/sql_update.cc: Fixes for Innobase
113 lines
3.4 KiB
C
113 lines
3.4 KiB
C
/******************************************************
|
|
A fast mutex for interprocess synchronization.
|
|
mutex_t can be used only within single process,
|
|
but ip mutex also between processes.
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
Created 9/30/1995 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#ifndef sync0ipm_h
|
|
#define sync0ipm_h
|
|
|
|
#include "univ.i"
|
|
#include "os0sync.h"
|
|
#include "sync0sync.h"
|
|
|
|
typedef struct ip_mutex_hdl_struct ip_mutex_hdl_t;
|
|
typedef struct ip_mutex_struct ip_mutex_t;
|
|
|
|
/* NOTE! The structure appears here only for the compiler to
|
|
know its size. Do not use its fields directly!
|
|
The structure used in a fast implementation of
|
|
an interprocess mutex. */
|
|
|
|
struct ip_mutex_struct {
|
|
mutex_t mutex; /* Ordinary mutex struct */
|
|
ulint waiters; /* This field is set to 1 if
|
|
there may be waiters */
|
|
};
|
|
|
|
/* The performance of the ip mutex in NT depends on how often
|
|
a thread has to suspend itself waiting for the ip mutex
|
|
to become free. The following variable counts system calls
|
|
involved. */
|
|
|
|
extern ulint ip_mutex_system_call_count;
|
|
|
|
/**********************************************************************
|
|
Creates, or rather, initializes
|
|
an ip mutex object in a specified shared memory location (which must be
|
|
appropriately aligned). The ip mutex is initialized in the reset state.
|
|
NOTE! Explicit destroying of the ip mutex with ip_mutex_free
|
|
is not recommended
|
|
as the mutex resides in shared memory and we cannot make sure that
|
|
no process is currently accessing it. Therefore just use
|
|
ip_mutex_close to free the operating system event and mutex. */
|
|
|
|
ulint
|
|
ip_mutex_create(
|
|
/*============*/
|
|
/* out: 0 if succeed */
|
|
ip_mutex_t* ip_mutex, /* in: pointer to shared memory */
|
|
char* name, /* in: name of the ip mutex */
|
|
ip_mutex_hdl_t** handle); /* out, own: handle to the
|
|
created mutex; handle exists
|
|
in the private address space of
|
|
the calling process */
|
|
/**********************************************************************
|
|
NOTE! Using this function is not recommended. See the note
|
|
on ip_mutex_create. Destroys an ip mutex */
|
|
|
|
void
|
|
ip_mutex_free(
|
|
/*==========*/
|
|
ip_mutex_hdl_t* handle); /* in, own: ip mutex handle */
|
|
/**********************************************************************
|
|
Opens an ip mutex object in a specified shared memory location.
|
|
Explicit closing of the ip mutex with ip_mutex_close is necessary to
|
|
free the operating system event and mutex created, and the handle. */
|
|
|
|
ulint
|
|
ip_mutex_open(
|
|
/*==========*/
|
|
/* out: 0 if succeed */
|
|
ip_mutex_t* ip_mutex, /* in: pointer to shared memory */
|
|
char* name, /* in: name of the ip mutex */
|
|
ip_mutex_hdl_t** handle); /* out, own: handle to the
|
|
opened mutex */
|
|
/**********************************************************************
|
|
Closes an ip mutex. */
|
|
|
|
void
|
|
ip_mutex_close(
|
|
/*===========*/
|
|
ip_mutex_hdl_t* handle); /* in, own: ip mutex handle */
|
|
/******************************************************************
|
|
Reserves an ip mutex. */
|
|
UNIV_INLINE
|
|
ulint
|
|
ip_mutex_enter(
|
|
/*===========*/
|
|
/* out: 0 if success,
|
|
SYNC_TIME_EXCEEDED if timeout */
|
|
ip_mutex_hdl_t* ip_mutex_hdl, /* in: pointer to ip mutex handle */
|
|
ulint time); /* in: maximum time to wait, in
|
|
microseconds, or
|
|
SYNC_INFINITE_TIME */
|
|
/******************************************************************
|
|
Releases an ip mutex. */
|
|
UNIV_INLINE
|
|
void
|
|
ip_mutex_exit(
|
|
/*==========*/
|
|
ip_mutex_hdl_t* ip_mutex_hdl); /* in: pointer to ip mutex handle */
|
|
|
|
|
|
|
|
#ifndef UNIV_NONINL
|
|
#include "sync0ipm.ic"
|
|
#endif
|
|
|
|
#endif
|