View Single Post
Old 22 December 2020, 13:32   #28
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Quote:
Originally Posted by tygre View Post
Hi all!

I'm still "stuck": my code works but from your comments, I'm not sure that it's doing what it should... Any memset or free of the struct StandardPacket * still causes a crash

You can see my current code here, am I missing something "obvious"?

Cheers!

this looks wrong:
Code:
do
        {
if(GetMsg(_con_reply_port))
            {
// Nothing to do
            }
else
            {
console_signal   = 1L << _con_reply_port->mp_SigBit;
received_signals = Wait(console_signal   |
SIGBREAKF_CTRL_C |
controls_signal_playing_stopped());
break;
            }
        }
while(TRUE);



consider the first GetMsg() returns NULL, then it waits for a signal and exits the loop without getting the message (if any).
So freeing/clearing the message will overwrite the node values of the still linked message.


Thus if a CTRL_C comes first you face the problem of having an unanswered message.


Maybe you can work around by using ACTION_WAIT_CHAR with a reasonable timeout.






bebbo is offline  
 
Page generated in 0.06199 seconds with 11 queries