mco_runtime_start

Start the database runtime.

Prototype

 
    MCO_RET mco_runtime_start(void)
 

Arguments

void

No arguments

Description

This function initializes a semaphore to coordinate access to the database dictionary. It must be called once, and only once, from each process that uses the eXtremeDB runtime, before the database is created with mco_db_open_dev() or mco_db_load() by the first process and before the database is connected to with mco_db_connect() in subsequent processes. All applications must call mco_runtime_start() to start and then mco_runtime_stop() to shut down the runtime gracefully before the application terminates. (Note that shared memory applications also need to start and stop the runtime.)

eXtremeSQL applications can start the runtime implicitly by calling the McoSqlEngine method open(McoSqlOpenParameters const &params) with the START_MCO_RUNTIME flag set in the McoSqlOpenParameters argument params. This flag is set by default. When the McoSqlEngine method close() is called the runtime is stopped implicitly.

Return Codes

MCO_S_OK The database was created successfully
MCO_E_SHM_ERROR Failed to allocate shared memory. (If using a shared memory database.)

Example

    Application snippet:


    int main(int argc, char* argv[])
    {
        mco_db_h	db;
        MCO_RET	rc;
        mco_device_t       dev;
        mco_db_params_t    db_params;

        if( (rc = mco_runtime_start()) != MCO_S_OK)

            exit(-1);

        ...
        mco_runtime_stop();
    }

Files

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