All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] occasional EBADF in select() in notifier.c
@ 2014-04-21 21:24 Matthias Schneider
  2014-04-21 21:32 ` Gilles Chanteperdrix
  2014-04-22  7:32 ` Philippe Gerum
  0 siblings, 2 replies; 8+ messages in thread
From: Matthias Schneider @ 2014-04-21 21:24 UTC (permalink / raw)
  To: xenomai@xenomai.org

Still working on thread suspension in forge/mercury, I occasionally get a EBADF
of the select() call in notifier.c. I suspect that this is due to accessing a 
copy of the file descriptor list notifier_rset while one of the file descriptors 
is being closed. This seems to be due to concurrent access on the notifier_rset 
from notifier_sighandler() and notifier_destroy(). "notifier_lock" is held in 
notifier_lock(), but not when copying and invoking select in notifier_sighandler().
The EBADF leads to a "spurious notification" reporting and process termination -
 obviously, the thread suspension was not triggered.

I can think of several ways of addressing this issue but I am not sure about 
side effects:
a) hold the "notifier_lock" mutex between copying the descriptor list and calling select
b) repeating the select() call in the case of EBADF

Any ideas?

Anyway, why is the select call necessary, isnt the file descriptor signaled via 
siginfo->si_fd, too?

Regards,
Matthias


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-23 13:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-21 21:24 [Xenomai] occasional EBADF in select() in notifier.c Matthias Schneider
2014-04-21 21:32 ` Gilles Chanteperdrix
2014-04-21 21:53   ` Gilles Chanteperdrix
2014-04-22  7:32 ` Philippe Gerum
2014-04-22 10:49   ` Matthias Schneider
2014-04-22 13:02     ` Philippe Gerum
2014-04-22 18:00       ` Matthias Schneider
2014-04-23 13:45         ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.