If your task is launched from WB you *MUST* read WBMessage first. And before you exit you reply to this message in Forbid() state.
In short (using pseudo-C) it goes like this:
start:
wbmsg = NULL;
task = FindTask(NULL)
if (task->pr_CLI == 0 )
{
WaitPort(&task->pr_MsgPort);
wbmsg = GetMsg(&task->pr_MsgPort);
}
; your code here
if ( wbmsg != NULL )
{
Forbid();
ReplyMsg(wbmsg);
}
return return_code;