switch(giConnectionType)
{
case CONNTYPE_SENDMESSAGE:
- // TODO: Less hack, I need a version of select for GetMessage etc
- if(SysGetMessage(NULL, NULL) == 0) sleep();
- while(SysGetMessage(NULL, NULL))
+ for( ;; )
{
pid_t tid;
- len = SysGetMessage(&tid, NULL);
+
+ // Wait for a message to arrive
+ while( !(len = SysGetMessage(&tid, NULL)) )
+ {
+ _SysWaitEvent(THREAD_EVENT_IPCMSG);
+ }
+
// Check if the message came from the server
if(tid != giConnectionNum)
{