mco_async_event_release

Unblock all the threads that are waiting on the specified event.

Prototype

 
    MCO_RET	mco_async_event_release(	/*IN*/ mco_db_h db, /*IN*/ in event_id);
 

Arguments

db The database handle that was established by mco_db_connect()

event_id

The identifier assigned to the event in the generated interface header file dbname.h

Description

This function unblocks all the threads that are waiting on the event referenced by event_id.

Return Codes

MCO_S_OK The event was released successfully
MCO_E_INVALID_HANDLE The database handle is invalid
MCO_S_EVENT_RELEASED The event was already released

Example

 
    Application snippet:

     
    const char * dbname = "SimpleDb";
     
    MCO_RET Event_NewHndlr( sample_task_t * descriptor )
    {
        int count = 0;
         
        /* use the connection created by sample_start_connected_task() */
        mco_db_h db = descriptor->db_connection;
        while ( MCO_S_OK == mco_async_event_wait(db, MCO_EVENT_newEvent) )
        {
            printf("\tNewEventHandler call %d\n", count);
            count++;
        }
        printf("\tExiting NewEventHandler. Number of calls : %d\n", count);
    }
     
    int main(int argc, char* argv[])
    {
        mco_db_h db;
        MCO_RET rc;
        mco_device_t       dev;
        mco_db_params_t    db_params;
        mco_trans_h t;
         
        ...
        rc = mco_db_open_dev( dbname, simple_get_dictionary(), &dev, 1, &db_params );
        if ( MCO_S_OK != rc )
        {
            rc = mco_db_connect(  dbname, &db );
            ...
                ...
                _beginthread( Event_NewHndlr, 0, (void*)db );
                Sleep(100);
                ...
                rc = mco_async_event_release(db, MCO_EVENT_newEvent);

                ...
            }
        }
        ...
    }
     
 

Files

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