Mercurial > octave
changeset 21846:8fb87d3f0581
Allow calls to the system function to be interrupted (bug #37672).
* thread-manager.cc (pthead_thread_manager::interrupt): Use kill to
generate signal instead of pthread_kill.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 24 Nov 2013 21:01:28 -0500 |
parents | f794cefc2372 |
children | 4d4e3e1723d1 |
files | libgui/src/thread-manager.cc |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/thread-manager.cc Thu Jun 09 21:20:09 2016 +0200 +++ b/libgui/src/thread-manager.cc Sun Nov 24 21:01:28 2013 -0500 @@ -71,7 +71,19 @@ void interrupt (void) { if (initialized) - pthread_kill (my_thread, SIGINT); + { + // Send SIGINT to all other processes in our process group. + // This is needed to interrupt calls to system (), for example. + + // FIXME: What happens if some code inside a + // {BEGIN,END}_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE block starts + // additional threads and one of those happens to catch this signal? + // Would the interrupt handler and the subsequent longjmp and exception + // all be executed in the wrong thread? If so, is there any way to + // prevent that from happening? + + kill (0, SIGINT); + } } private: