Minor fixes to improve thread safety

Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
Mahyar Koshkouei
2017-02-10 08:48:26 +00:00
parent 3df3461027
commit 888c4a1505
2 changed files with 17 additions and 10 deletions

View File

@@ -223,7 +223,10 @@ static int changeFile(const char* ep_file)
static Thread thread = NULL;
static char* file = NULL;
/* If music is playing, stop it */
/**
* If music is playing, stop it. Only one playback thread should be playing
* at any time.
*/
if(thread != NULL)
{
/* Tell the thread to stop playback before we join it */
@@ -246,7 +249,7 @@ static int changeFile(const char* ep_file)
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);
thread = threadCreate(playFile, file, 32 * 1024, prio - 1,
-2, true);
-2, false);
return 0;
}