Hi all,
I solved my problem and I am posting my answer here for others to use.
In the main thread, I did:
// Create a channel to receive messages on.
chid = ChannelCreate(0);
// Connect to the channel to send messages on.
coid = ConnectAttach(0, 0, chid, _NTO_SIDE_CHANNEL, 0);
// Start a thread dedicated to receive pulses and setting up
// ionotify
pthread_create(&tid, NULL, process_IPC, NULL);
// Set up the event structure for pulse messages
SIGEV_PULSE_INIT( &event, coid, 15, PULSE_CODE, 0);
// Register for notifications of received data
if((status = ionotify( fd, _NOTIFY_ACTION_TRANARM, _NOTIFY_COND_INPUT, &event)) == -1)
{
printf( "ionotify() failed: %s\n", strerror( errno));
}
The thread looks like:
void* process_IPC (void *arg)
{
int rcvid = 0;
int status = 0;
struct _pulse pulse;
static long events = 0;
for (; ; )
{
rcvid = MsgReceive(chid, &pulse, sizeof(pulse), NULL);
if (rcvid != 0)
{
printf("Received a message\n" );
}
if (rcvid == 0)
{
if (pulse.code == PULSE_CODE)
{
printf("%ld: we got notified by the driver: event# %d occured\n", events++, pulse.value.sival_int);
if((status = ionotify( fd, _NOTIFY_ACTION_TRANARM, _NOTIFY_COND_INPUT, &event)) == -1)
{
printf( "ionotify() failed: %s\n", strerror( errno));
}
}
}
}
}
I hope this is usefull to others.
Hereby, I want to thank Rick and RoverFan for their help.
Cheers,
Freddy