none
PlaySound() called by a lower thread causes delay in executing a higher priority thread RRS feed

  • Question

  • Hello,

    I have an OMAP3530-based board with WINCE 6.0 R3 and TI BSP_ARM_A8.  I have a problem in which a higher priority thread, which is supposed to run every 2ms, is delayed for several milliseconds every time a lower priority thread plays a wave file by calling PlaySound().

    A similar application is running fine on different hardware with WINCE 5.0 and different BSP.  Is it a WINCE or BSP problem?

    I appreciate your advice,

    Luan


    Luan Le
    Thursday, August 18, 2011 4:19 PM

All replies

  • Following things i can comment which could be helpful :-

    1. To me i thing the issue could be related to BSP precisely the Audio Driver implementation.

    For that you need to compare the drivers in the two BSP's you have.

     

    2. Do a profiling and see what is really causing the lower priority thread hold the resource and not allowing the thread with higher priority to run.

     

    3. Try to allocate the priority of both the thread same so that there should not be inversion between these two threads and both should be ready to run in round robin fashion.

     

    ---Misbah


    Senior Design Engineer T.E.S Electronic Solutions (Bangalore-India) www.tesbv.com email-misbah.khan@tes-dst.com
    Friday, August 19, 2011 5:24 AM
  • "supposed to run every 2ms" , how do you accomplish this ?
    Threading intervals are completely depending on schedular behaviour, and per thread you cannot assume the interval will be constant.
    So a simple Sleep(2) won't do it.....

    If you need a hard timing for your thread, you need to trigger it from hardware.
    See : http://msdn.microsoft.com/en-us/library/ms836797.aspx

    Rob
    www.robtso.nl

     

    Monday, August 22, 2011 8:45 AM
  • If you have control over the thread calling PlaySound, try add the SND_ASYNC flag in the call to the function
    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    Monday, August 22, 2011 9:10 AM