I'm just fooling around. I managed to compile it and fix a bug that made it crash every time it loaded some code, but apart from that there's not so much progress.
Hmmm... Are you sure it's not returning a -1 when there's a message already waiting when it's called, and a 0 when not? Or something along those lines?
It should return the signal it receives. That is, if it receives SIGBREAKF_CTRL_C, then it returns that, if it receives a signal from the port, it returns a field with just the ports signal bit set. That's how it works in my test app, and that's how the docs describe it. Only place it doesn't work is in GDB. Strange...
The Wait() will return ALL the signal bits that are currently set, so in theory could have any number of bits set (up to 0xFFFFFFFF).
The -1 value is often used to signal an invalid signal bit number. The signal bit number can be anything from [0:31], and -1 is used in some calls (eg AllocSignal() to show failure. I wonder if the signal bit in your MsgPort has become corrupted, or perhaps the MsgPort has been deleted?
sig = IExec->Wait(SIGBREAKF_CTRL_C|SIGBREAK_CTRL_D|1<<msgport->mp_SigBit);
First of all that should be SIGBREAKF_CTRL_D and not SIGBREAK_CTRL_D. Also I suggest putting a parenthesis around "1<<msgport->mp_SigBit" as this will if nothing else make your code much more readable (I don't remember what the relative precedences of bitwise or and shifting are in C so I can't say if not having a parenthesis will cause the wrong value to be calculated or not).
As tonyw says 0xffffffff is a valid return value from IExec->Wait() and would mean that all the task's 32 signals have been set. Maybe this is what happened?
Also you haven't posted the code that you use to display the return value from IExec->Wait(). Maybe there is a bug there?
are you wanting only a binary or the whole sources ? Anyway MickJT have both and binary archive is online and directly downloadable, while for the source archive you must PM him. All you need is in this thread : http://www.amigans.net/modules/newbb/ ... t_id=56044#forumpost56044