/*
 *  FixSignal.C
 */

#include "lib.h"

#include <exec/lists.h>

/* set the signal  for this channel's port signal bit, if there is something
** in the channel's MsgList, or if there is something in the channel's rdy list
*/

/* 
**  according to the RKM's, setting signals like this is 'Dangerous'  
**  On the other hand, this is generally called when the channel has had
**  something processed on it, which might not be that bad...
*/

/* 
**check if the channel is not empty. If so, set signal bit for the channel
*/
void
FixSignal(_chan)
void *_chan;
{
    CHANN *chan = (CHANN *)_chan;
    /* is the channel's message list empty? */
    if(
/* chan->port.mp_MsgList.lh_Head != (NODE *)&chan->port.mp_MsgList.lh_Tail ||
chan->rdylist.lh_Head != (NODE *)&chan->rdylist.lh_Tail */
       !(  IsMsgPortEmpty((PORT * ) &(chan->port))  &&
           IsListEmpty((LIST *) &chan->rdylist)
	)
    )
	SetSignal(1 << chan->port.mp_SigBit, 1 << chan->port.mp_SigBit);
}
