예제 #1
0
void SuiteMulticast::Test()
{
    iThread0->Start();
    iThread1->Start();

    iSender.Wait();
    iSender.Wait();

    SocketUdp send;

    Bwn buf(iExp);
    TUint i;
    for( i=0; i < kMsgBytes; i++) {
        buf.SetBytes(0);
        AppendUint32(buf, i); //num of bytes in this message
        buf.SetBytes(i + sizeof(TUint)); //use prefilled values
        send.Send(buf, Endpoint(iPort, kMulticastAddress));
        // assume that a delay of 500ms without response implies that the message wasn't delivered
        try {
            iSender.Wait(500);
            iSender.Wait(500);
        }
        catch (Timeout&) {
            Print("SuiteMulticast - message(s) not delivered\n");
            TEST(1 == 0);
            return; // temp
        }

        if (iSender.Clear()) {
            TEST(1 == 0);
            Print("SuiteMulticast - sent one message, received more than once\n");
        }
    }

    buf.SetBytes(0);
    AppendUint32(buf, kQuit);
    send.Send(buf, Endpoint(iPort, kMulticastAddress));

    try {
        iSender.Wait(500);
        iSender.Wait(500);
    }
    catch (Timeout&) {
        Print("SuiteMulticast - quit message(s) not delivered\n");
    }
}
예제 #2
0
파일: TestThread.cpp 프로젝트: Jacik/ohNet
void SuiteThreadFunctor::Test()
{
    iSem = new Semaphore("", 0);
    iFunctor = new ThreadFunctor("STFF", MakeFunctor(*this, &SuiteThreadFunctor::Run));
    iFunctor->Start();
    iSem->Wait();
    delete iFunctor;
    delete iSem;
}
예제 #3
0
파일: TestThread.cpp 프로젝트: Jacik/ohNet
void SuiteThreadFunctorStartDelete::Test()
{
    PrioSaw ps(kPrioritySystemLowest, kPrioritySystemHighest);

    for (TUint i=0; i< kThreadCount; i++) {
        ThreadFunctor* tf = new ThreadFunctor("TFSD", MakeFunctor(*this, &SuiteThreadFunctorStartDelete::Run), ps.Next());
        tf->Start();
        delete tf;

        if (i % kUpdateInterval == 0) {
            TEST(true); // only to show progress
            Thread::Sleep(100); // FreeRTOS delegates freeing of thread resources to the idle thread. We allow it to run here.
        }
    }
}
예제 #4
0
파일: Main.cpp 프로젝트: astaykov/ohNet
int main(int argc, char* argv[])
{
    ThreadFunctor* t = new ThreadFunctor("MAIN", MakeFunctor(NULL, threadMain));
    t->Start();
    return 0;
}