/** * Destroy a timer * * @param timer a pointer to a timer * @return VXItrdResult of operation. Return SUCCESS if timer has been * created * */ VXITRD_API VXItrdResult VXItrdTimerDestroy(VXItrdTimer **timer) { if ((timer == NULL) || (*timer == NULL)) return VXItrd_RESULT_INVALID_ARGUMENT; // Don't leave the corresponding thread in a suspended state. VXItrdResult rc = VXItrd_RESULT_SUCCESS; if ((*timer)->isSleeping) { VXItrdTimerWake(*timer); // Wait for the sleeping thread to wake up, note that on some OSes // like Linux the timeout is modified to give the actual amount of // time slept so need to re-initialize each time while (((*timer)->isSleeping) && ((rc = VXItrdSleep (50)) == VXItrd_RESULT_SUCCESS)) ; // keep going } delete *timer; *timer = NULL; return rc; }
// Set the event VXItrdResult SBtrdEvent::Set( ) { Diag (0, L"SBtrdEvent::Set", L"enter: this 0x%p", this); _alerted = TRUE; return VXItrdTimerWake (_timer); }