Fix locking in waitForEvent() and sample playing
This commit is contained in:
@ -269,11 +269,13 @@ void waitForEvent(int source, int value) {
|
||||
pthread_mutex_lock(&eventMutex);
|
||||
t->waitSource = source;
|
||||
t->waitValue = value;
|
||||
stopUser();
|
||||
// spourious wake ups may occur they say
|
||||
while (t->waitSource) {
|
||||
pthread_cond_wait(&t->waitCond, &eventMutex);
|
||||
}
|
||||
pthread_mutex_unlock(&eventMutex);
|
||||
startUser();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ namespace pxt {
|
||||
void raiseEvent(int id, int event);
|
||||
int allocateNotifyEvent();
|
||||
void sleep_core_us(uint64_t us);
|
||||
void startUser();
|
||||
void stopUser();
|
||||
|
||||
class Button;
|
||||
typedef Button *Button_;
|
||||
|
Reference in New Issue
Block a user