Menu

#411 Performace fix in windows_sim vos_mutexLock

3.0.0.0
closed
Sim (13) 2361 (1)
2024-02-05
2023-01-13
No

In TimeSync multi core mode the mutex can quickly be unlocked,
no need to do a thread delay first try an ordinary delay 1ms. After that perform a threadDelay (Timesync break).
Note: If this delay is too long to system can get a dead look.

This change improves the performance of a multithread app with a lot of data traffic.

Discussion

  • Anders Öberg

    Anders Öberg - 2023-01-13

    Change to the following code:
    int timeSyncMode = TimeSyncGetMode();

    if (timeSyncMode == TIMESYNC_MULTI_CORE)
    {
        //In multi core mode the mutex can quickly be unlocked, 
        //no need to do an thread delay first try a ordinary delay 1ms
        //If this delay is too long to system can get a dead look
        dwMillesecoundDelay = 1;
    }
    
    ...
    
    DWORD dwWaitResult = WaitForSingleObject(pMutex->mutexId, dwMillesecoundDelay);
    
    ...
    
            dwMillesecoundDelay = 0;
        } while (TRUE);
    
     
  • Armin-Hagen Weiss

    • status: open --> accepted
     
  • Anders Öberg

    Anders Öberg - 2023-01-13
    • labels: --> Sim
     
  • Anders Öberg

    Anders Öberg - 2023-01-13

    Commit at 2361

     
  • Anders Öberg

    Anders Öberg - 2023-01-13
    • status: accepted --> closed
     
  • Armin-Hagen Weiss

    • labels: Sim --> Sim, 2361
    • Milestone: 2.1.0.0 --> 2.2.0.0
     

Log in to post a comment.

MongoDB Logo MongoDB