VirtualBox

Changeset 19923 in vbox


Ignore:
Timestamp:
May 22, 2009 5:53:47 PM (16 years ago)
Author:
vboxsync
Message:

tstSupSem.cpp: Extended the interruptibility test with a time wait (non-infinite).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/testcase/tstSupSem.cpp

    r19895 r19923  
    4848static PSUPDRVSESSION   g_pSession;
    4949static RTTEST           g_hTest;
     50static uint32_t         g_cMillies; /* Used by the interruptible tests. */
    5051
    5152
     
    5556    SUPSEMEVENT hEvent = (SUPSEMEVENT)pvUser;
    5657    RTThreadUserSignal(hSelf);
    57     return SUPSemEventWaitNoResume(g_pSession, hEvent, RT_INDEFINITE_WAIT);
     58    return SUPSemEventWaitNoResume(g_pSession, hEvent, g_cMillies);
    5859}
    5960
     
    6364    SUPSEMEVENTMULTI hEventMulti = (SUPSEMEVENTMULTI)pvUser;
    6465    RTThreadUserSignal(hSelf);
    65     return SUPSemEventMultiWaitNoResume(g_pSession, hEventMulti, RT_INDEFINITE_WAIT);
     66    return SUPSemEventMultiWaitNoResume(g_pSession, hEventMulti, g_cMillies);
    6667}
    6768
     
    142143    RTTestSub(hTest, "SRE Interruptibility");
    143144    RTTESTI_CHECK_RC(SUPSemEventCreate(pSession, &hEvent), VINF_SUCCESS);
     145    g_cMillies = RT_INDEFINITE_WAIT;
    144146    RTTHREAD hThread = NIL_RTTHREAD;
    145147    RTTESTI_CHECK_RC(RTThreadCreate(&hThread, tstSupSemInterruptibleSRE, (void *)hEvent, 0, RTTHREADTYPE_TIMER, RTTHREADFLAGS_WAITABLE, "IntSRE"), VINF_SUCCESS);
     
    152154    RTTESTI_CHECK_RC(SUPSemEventClose(pSession, hEvent), VINF_OBJECT_DESTROYED);
    153155
     156    RTTESTI_CHECK_RC(SUPSemEventCreate(pSession, &hEvent), VINF_SUCCESS);
     157    g_cMillies = 120*1000;
     158    hThread = NIL_RTTHREAD;
     159    RTTESTI_CHECK_RC(RTThreadCreate(&hThread, tstSupSemInterruptibleSRE, (void *)hEvent, 0, RTTHREADTYPE_TIMER, RTTHREADFLAGS_WAITABLE, "IntSRE"), VINF_SUCCESS);
     160    RTTESTI_CHECK_RC(RTThreadUserWait(hThread, 60*1000), VINF_SUCCESS);
     161    RTThreadSleep(120);
     162    RTThreadPoke(hThread);
     163    rcThread = VINF_SUCCESS;
     164    RTTESTI_CHECK_RC(RTThreadWait(hThread, 60*1000, &rcThread), VINF_SUCCESS);
     165    RTTESTI_CHECK_RC(rcThread, VERR_INTERRUPTED);
     166    RTTESTI_CHECK_RC(SUPSemEventClose(pSession, hEvent), VINF_OBJECT_DESTROYED);
     167
     168
    154169    RTTestSub(hTest, "MRE Interruptibility");
    155170    RTTESTI_CHECK_RC(SUPSemEventMultiCreate(pSession, &hEventMulti), VINF_SUCCESS);
     171    g_cMillies = RT_INDEFINITE_WAIT;
    156172    hThread = NIL_RTTHREAD;
    157173    RTTESTI_CHECK_RC(RTThreadCreate(&hThread, tstSupSemInterruptibleMRE, (void *)hEventMulti, 0, RTTHREADTYPE_TIMER, RTTHREADFLAGS_WAITABLE, "IntMRE"), VINF_SUCCESS);
     
    164180    RTTESTI_CHECK_RC(SUPSemEventMultiClose(pSession, hEventMulti), VINF_OBJECT_DESTROYED);
    165181
    166 #endif
     182    RTTESTI_CHECK_RC(SUPSemEventMultiCreate(pSession, &hEventMulti), VINF_SUCCESS);
     183    g_cMillies = 120*1000;
     184    hThread = NIL_RTTHREAD;
     185    RTTESTI_CHECK_RC(RTThreadCreate(&hThread, tstSupSemInterruptibleMRE, (void *)hEventMulti, 0, RTTHREADTYPE_TIMER, RTTHREADFLAGS_WAITABLE, "IntMRE"), VINF_SUCCESS);
     186    RTTESTI_CHECK_RC(RTThreadUserWait(hThread, 60*1000), VINF_SUCCESS);
     187    RTThreadSleep(120);
     188    RTThreadPoke(hThread);
     189    rcThread = VINF_SUCCESS;
     190    RTTESTI_CHECK_RC(RTThreadWait(hThread, 60*1000, &rcThread), VINF_SUCCESS);
     191    RTTESTI_CHECK_RC(rcThread, VERR_INTERRUPTED);
     192    RTTESTI_CHECK_RC(SUPSemEventMultiClose(pSession, hEventMulti), VINF_OBJECT_DESTROYED);
     193#endif /* !OS2 && !WINDOWS */
    167194
    168195    /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette