Re: signaling in cpg_dispatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patrick,
I'm unsure if I really understand your question. cpg_dispatch doesn't
check errno and doesn't do restart.

I believe what you want to achieve is alarm handler. Way how to do it,
is to use select/poll on cpg/(any other service) fd and call
cpg_dispatch only when fd is ready for read. Alarm handler can then set
variable which is checked after cpg_dispatch call. If you have only
cpg_dispatch, you even don't need poll, but can directly run endless
loop. so pseudocode fragment:

int want_exit_loop = 0;

sigalarm_handler() {
	want_exit_loop = 1;
}

...

while (!want_exit_loop) {
    cpg_dispatch();
}

...

If I didn't understood your question correctly, please try reformulate
it or even better, send code fragment.

Regards,
  Honza

Patrick Hemmer napsal(a):
> So I'm trying to write an application which uses CPG but am having a
> problem with cleanly terminating the application.
> 
> The issue is that when calling cpg_dispatch, if the process gets a
> signal while it's sitting on the `poll()` call, and there is a signal
> handler defined, upon return from the signal handler, errno is set to
> EINTR which causes cpg_dispatch to restart the call to qb_ipcc_event_recv.
> Basically nothing other than a SIGKILL (or a signal which has no handler
> and results in the default action of exit) can terminate the app. And
> aside from terminating, if you wanted to use a SIGALRM to break the
> poll() and go do other things, you can't.
> 
> I'm using corosync 2.3.2 and libqb 0.14.4
> 
> This assessment correct or am I missing something?
> 
> -Patrick
> 
> 
> 
> _______________________________________________
> discuss mailing list
> discuss@xxxxxxxxxxxx
> http://lists.corosync.org/mailman/listinfo/discuss
> 

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux