예제 #1
0
/*  Description:     Load the middleware bridge, initialize MAMA, begin
 *                   processing messages in a non-default thread, stop
 *                   processing on the non-default thread, close MAMA.
 *
 *  Expected Result: MAMA_STATUS_OK
 */
TEST_F (MamaOpenCloseTestC, StartStopDifferentThreads)
{
    mamaBridge bridge;
    ASSERT_EQ (MAMA_STATUS_OK, mama_loadBridge (&bridge, getMiddleware()));

    ASSERT_EQ (MAMA_STATUS_OK, mama_open());

    /* Start mama in the background so it uses a different thread */
    wsem_t sem;
    mamaQueue defaultQueue;
    ASSERT_EQ (0, wsem_init (&sem, 0, 0));
    ASSERT_EQ (MAMA_STATUS_OK, mama_getDefaultEventQueue (bridge, &defaultQueue));
    ASSERT_EQ (MAMA_STATUS_OK, mamaQueue_enqueueEvent (defaultQueue, onEventStop, bridge));
    ASSERT_EQ (MAMA_STATUS_OK, mama_startBackgroundEx (bridge, startCallback, &sem));
    ASSERT_EQ (0, wsem_wait (&sem));

    ASSERT_EQ (MAMA_STATUS_OK, mama_close());
}
예제 #2
0
 void Mama::startBackground (mamaBridge bridgeImpl,
                             MamaStartCallback* cb)
 {
     mamaTry (mama_startBackgroundEx (bridgeImpl, mamaStopCBEx(stopCb), static_cast<void*>(cb)));
 }