Beispiel #1
0
static void start ()
{
    if (gPubBridge != gSubBridge)
    {
        mama_startBackground (gPubBridge, startCB);
    }

    mama_start (gSubBridge);
}
/*  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 mBridge;
    mama_loadBridge (&mBridge, getMiddleware());

    ASSERT_EQ (MAMA_STATUS_OK, mama_open());

    /* Start mama in the background so it uses a different thread */
    ASSERT_EQ (MAMA_STATUS_OK, mama_startBackground (mBridge, startCallback));

    /* Sleep to allow the other thread to complete startup */
    sleep(2);

    ASSERT_EQ (MAMA_STATUS_OK, mama_stop (mBridge));

    ASSERT_EQ (MAMA_STATUS_OK, mama_close());
}