Changeset 10269 for trunk/src/winmm/os2timer.cpp
- Timestamp:
- Oct 13, 2003, 11:18:38 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/winmm/os2timer.cpp
r9916 r10269 1 /* $Id: os2timer.cpp,v 1.2 1 2003-03-06 15:42:33sandervl Exp $ */1 /* $Id: os2timer.cpp,v 1.22 2003-10-13 09:18:37 sandervl Exp $ */ 2 2 3 3 /* … … 239 239 OS2Timer::OS2Timer() : TimerSem(0), TimerHandle(0), hTimerThread(0), 240 240 clientCallback(NULL), TimerStatus(Stopped), fFatal(FALSE), 241 next(NULL), timerID(0) 241 next(NULL), timerID(0), refCount(0) 242 242 { 243 243 dprintf(("WINMM:OS2Timer: OS2Timer::OS2Timer(%08xh)\n", … … 266 266 return; // terminate thread 267 267 } 268 269 270 //hTimerThread = _beginthread(TimerHlpHandler, NULL, 0x4000, (void *)this); 268 269 //increase reference count for creation 270 addRef(); 271 272 //increase reference count since the thread will access the object 273 addRef(); 271 274 hTimerThread = CreateThread(NULL, 272 275 0x4000, … … 392 395 TimerStatus = InActive; 393 396 } 397 //****************************************************************************** 398 //****************************************************************************** 399 #ifdef DEBUG 400 LONG OS2Timer::addRef() 401 { 402 //// dprintf2(("addRef %x -> refcount %x", this, refCount+1)); 403 return InterlockedIncrement(&refCount); 404 }; 405 #endif 406 /******************************************************************************/ 407 //****************************************************************************** 408 LONG OS2Timer::release() 409 { 410 #ifdef DEBUG 411 if(refCount-1 < 0) { 412 DebugInt3(); 413 } 414 #endif 415 if(InterlockedDecrement(&refCount) == 0) { 416 dprintf2(("marked for deletion -> delete now")); 417 delete this; 418 return 0; 419 } 420 return refCount; 421 } 394 422 /******************************************************************************/ 395 423 //****************************************************************************** … … 414 442 clientCallback)); 415 443 416 DosWaitEventSem(TimerSem, SEM_INDEFINITE_WAIT); 417 DosResetEventSem(TimerSem, &Count); 444 rc = DosWaitEventSem(TimerSem, SEM_INDEFINITE_WAIT); 445 if(rc) { 446 dprintf(("DosWaitEventSem failed with %d", rc)); 447 DebugInt3(); 448 } 449 rc = DosResetEventSem(TimerSem, &Count); 450 if(rc) { 451 dprintf(("DosResetEventSem failed with %d", rc)); 452 DebugInt3(); 453 } 418 454 if(!fFatal) 419 455 { … … 434 470 if (clientCallback != NULL) 435 471 { 436 selTIB = SetWin32TIB(); 437 clientCallback((UINT)timerID, 0, userData, 0, 0); 438 SetFS(selTIB); 472 clientCallback((UINT)timerID, 0, userData, 0, 0); 439 473 } 440 474 break; … … 462 496 463 497 DosCloseEventSem(TimerSem); 498 499 //release object 500 release(); 464 501 465 502 // mark this thread as terminated … … 474 511 return 0; 475 512 } 476 477 478 513 //****************************************************************************** 479 514 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.