NXC

Not eXactly C

Topics

Threads

PlaySound() is not thread safe.

Keywords

  • PlaySound is not thread safe. If you call it from more than one simultaneous task, some tasks may block. A workaround is

to define the wrapper function below, then call that function instead of calling PlaySound.

// inline to get around PlaySound not being threadsafe
mutex __muPlaySound;
inline void safePlaySound(int sound) {
    Acquire(__muPlaySound);
    PlaySound(sound);
    Release(__muPlaySound);
}

External Links

NXC Programmer's Guide

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License