{
// unlock and wait
pthread_mutex_unlock(&masterLock);
- logger->log("Command", Log::DEBUG, "un-LOCKED MASTER MUTEX");
button = remote->getButtonPress(2); // FIXME why is this set to 2 and not 0? so it can quit
// something happened, lock and process
pthread_mutex_lock(&masterLock);
- logger->log("Command", Log::DEBUG, "LOCKED MASTER MUTEX");
if ((button == Remote::NA_NONE) || (button == Remote::NA_UNKNOWN)) continue;
// locking the mutex ensures that the master thread is waiting on getButtonPress
pthread_mutex_lock(&masterLock);
- logger->log("Command", Log::DEBUG, "LOCKED MASTER MUTEX");
MessageQueue::postMessage(m);
kill(mainPid, SIGURG);
pthread_mutex_unlock(&masterLock);
- logger->log("Command", Log::DEBUG, "un-LOCKED MASTER MUTEX");
}
bool Command::postMessageIfNotBusy(Message* m)
if (pthread_mutex_trylock(&masterLock) != EBUSY)
{
- logger->log("Command", Log::DEBUG, "LOCKED MASTER MUTEX");
MessageQueue::postMessage(m);
kill(mainPid, SIGURG);
pthread_mutex_unlock(&masterLock);
- logger->log("Command", Log::DEBUG, "un-LOCKED MASTER MUTEX");
return true;
}
else
}
case Message::TIMER:
{
- // FIXME lock main mutex
- // FIXME Reply - if messages are being processed then main loop is on processMessageQueue()
- // -- this means the mutex is locked
-
- // FIXME investigate whether timer can have fired, but waits on this mutex,
- // a view is deleted, then the timer runs on a non-object
-
// FIXME - go to one message queue only - then instead of having
// objects deriving from messagequeues, make them derive from
// messagereceiver - then one messagequeue can deliver any message to anywhere
// deliver timer
- logger->log("Command", Log::DEBUG, "m = %p", m);
- logger->log("Command", Log::DEBUG, "m->message = %i", m->message);
- logger->log("Command", Log::DEBUG, "m->from = %p", m->from);
- logger->log("Command", Log::DEBUG, "m->to = %p", m->to);
- logger->log("Command", Log::DEBUG, "m->parameter = %p", m->parameter);
((TimerReceiver*)m->to)->timercall(m->parameter);
handleCommand(Remote::NA_NONE); // in case any timer has posted messages to viewman,
// run viewman message queue here. FIXME improve this!