# mco_begin_wait_event
RT

> Set the current wait event type for profiling and diagnostics.

### Prototype

        void mco_begin_wait_event(
            /*IN*/ mco_db_h con,
            /*IN*/ MCO_WAIT_EVENT event
        );

### Arguments

`con`
Database connection handle.
`event`
One of the values from the `MCO_WAIT_EVENT` enumeration, indicating the type of wait event being entered. Common values include:

- `MCO_WAIT_EVENT_READ`, `MCO_WAIT_EVENT_WRITE` — I/O operations,
- `MCO_WAIT_EVENT_MVCC_*` — various MVCC lock and latch waits,
- `MCO_WAIT_EVENT_SOCKET_RECV`, `MCO_WAIT_EVENT_SOCKET_SEND` — network I/O,
- `MCO_WAIT_EVENT_NONE` — to clear the current wait state.

See the full list in the description below.

### Description

> This function records the current wait event type in the database connection context. It is used internally by the eXtremeDB runtime for profiling, performance monitoring, and deadlock detection.

> The wait event is typically set just before entering a blocking operation (e.g., acquiring a lock, waiting for I/O) and cleared afterward by calling `mco_begin_wait_event(con, MCO_WAIT_EVENT_NONE)`.

> Full list of wait events:

>         typedef enum MCO_WAIT_EVENT_E_ {
>             MCO_WAIT_EVENT_NONE,
>             MCO_WAIT_EVENT_READ,
>             MCO_WAIT_EVENT_WRITE,
>             MCO_WAIT_EVENT_FLUSH,
>             MCO_WAIT_EVENT_MURSIW_TM_LOCK,
>             MCO_WAIT_EVENT_MURSIW_TRANS_LOCK,
>             MCO_WAIT_EVENT_MURSIW_READER_LOCK,
>             MCO_WAIT_EVENT_MURSIW_WRITER_LOCK,
>             MCO_WAIT_EVENT_MVCC_CS_LOCK,
>             MCO_WAIT_EVENT_MVCC_TM_LOCK,
>             MCO_WAIT_EVENT_MVCC_PM_MUTEX,
>             MCO_WAIT_EVENT_MVCC_EXCLUSIVE_LOCK,
>             MCO_WAIT_EVENT_MVCC_SERIALIZABLE_LOCK,
>             MCO_WAIT_EVENT_MVCC_TREE_READ_LOCK,
>             MCO_WAIT_EVENT_MVCC_TREE_WRITE_LOCK,
>             MCO_WAIT_EVENT_MVCC_LEAF_READ_LOCK,
>             MCO_WAIT_EVENT_MVCC_LEAF_WRITE_LOCK,
>             MCO_WAIT_EVENT_MVCC_BLOB_MUTEX,
>             MCO_WAIT_EVENT_MVCC_HASH_WRITE_LOCK,
>             MCO_WAIT_EVENT_MVCC_HASH_READ_LOCK,
>             MCO_WAIT_EVENT_MVCC_KDTREE_WRITE_LOCK,
>             MCO_WAIT_EVENT_MVCC_KDTREE_READ_LOCK,
>             MCO_WAIT_EVENT_MVCC_HNSW_WRITE_LOCK,
>             MCO_WAIT_EVENT_MVCC_HNSW_READ_LOCK,
>             MCO_WAIT_EVENT_MVCC_PTREE_WRITE_LOCK,
>             MCO_WAIT_EVENT_MVCC_PTREE_READ_LOCK,
>             MCO_WAIT_EVENT_MVCC_RTREE_WRITE_LOCK,
>             MCO_WAIT_EVENT_MVCC_RTREE_READ_LOCK,
>             MCO_WAIT_EVENT_MVCC_FRA_MUTEX,
>             MCO_WAIT_EVENT_MVCC_DB_MUTEX,
>             MCO_WAIT_EVENT_MVCC_PAGE_LATCH,
>             MCO_WAIT_EVENT_MVCC_TREE_LATCH,
>             MCO_WAIT_EVENT_MVCC_BUNDLE_LATCH,
>             MCO_WAIT_EVENT_MVCC_COMPRESSOR_LATCH,
>             MCO_WAIT_EVENT_DM_MUTEX,
>             MCO_WAIT_EVENT_RAW_PAGE,
>             MCO_WAIT_EVENT_DM_ALLOC_MUTEX,
>             MCO_WAIT_EVENT_EXCLUSIVE_COMMIT_LOCK,
>             MCO_WAIT_EVENT_SHARED_COMMIT_LOCK,
>             MCO_WAIT_EVENT_ASYNC_LOCK,
>             MCO_WAIT_EVENT_ASYNC_MUTEX,
>             MCO_WAIT_EVENT_HEADER_LOCK,
>             MCO_WAIT_EVENT_WCHAR_BUF_MUTEX,
>             MCO_WAIT_EVENT_SOCKET_RECV,
>             MCO_WAIT_EVENT_SOCKET_SEND,
>             MCO_WAIT_EVENT_LAST
>         } MCO_WAIT_EVENT;

> Note: This is an internal diagnostic function. Applications should not call it directly unless implementing custom profiling or debugging extensions.

### Return Value

None
This function does not return a value.

### Files

Header file:
mco.h
Source file:
mcoconn.c
Library:
libmcolib.a