I want to be able to send an asynchronous notification from a resource
manager to the application using it.
So far I’m using the io_notify method and try to send a signal to the
application when a notification occurs but I can’t get it to work.
I used the resource manager example from the programmer’s guide as a
template except that in io_notify, I just set trig to _NOTIFY_COND_OBAND.
in the resource manager, whenever I want to send the notification, I
call iofunc_notify_trigger(dattr->notify, 1, IOFUNC_NOTIFY_OBAND);
In the application using the resource manager, I do the following to be
able to receive the notification as a signal:
void handler(int sig);
struct sigaction act;
struct sigevent event;
act.sa_handler = handler;
act.sa_flags = 0;
sigaction(SIGRTMIN, &act, NULL);
memset(&event, 0, sizeof(struct sigevent));
ionotify(fd, _NOTIFY_ACTION_POLLARM, _NOTIFY_COND_OBAND, &event);
The problem is that the signal handler is never called when the resource
manager send the notification.
Is it supposed to work? or am I doing something wrong?