Mercurial > hg > octave-nkf
annotate libgui/src/thread-manager.cc @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
17922
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17998
diff
changeset
|
3 Copyright (C) 2013-2015 John W. Eaton |
17922
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 This file is part of Octave. |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 option) any later version. |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 for more details. |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 */ |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 #include <config.h> |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 #endif |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #if defined (__WIN32__) && ! defined (__CYGWIN__) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #include <windows.h> |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #else |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 #include <pthread.h> |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #endif |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #include <sys/types.h> |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 #include <signal.h> |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 |
17958
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17922
diff
changeset
|
36 #include "sighandlers.h" |
17922
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 #include "thread-manager.h" |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 #if defined (__WIN32__) && ! defined (__CYGWIN__) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 class windows_thread_manager : public octave_base_thread_manager |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 { |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 public: |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 windows_thread_manager (void) : octave_base_thread_manager () { } |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 void register_current_thread (void) { } |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 void interrupt (void) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 { |
17971
54784619350b
Make CTRL-C to work in GUI with "system" calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17958
diff
changeset
|
51 GenerateConsoleCtrlEvent (CTRL_C_EVENT, 0); |
17922
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 } |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 }; |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 #else |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 class pthread_thread_manager : public octave_base_thread_manager |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 { |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 public: |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
60 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 pthread_thread_manager (void) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 : octave_base_thread_manager (), my_thread (), initialized (false) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 { } |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 void register_current_thread (void) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
66 { |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
67 my_thread = pthread_self (); |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
68 initialized = true; |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
69 } |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
70 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 void interrupt (void) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 { |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
73 if (initialized) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
74 pthread_kill (my_thread, SIGINT); |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
75 } |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
76 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
77 private: |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
78 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
79 pthread_t my_thread; |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
80 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
81 bool initialized; |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
82 }; |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
83 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
84 #endif |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
85 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
86 octave_thread_manager::octave_thread_manager (void) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
87 : rep (octave_thread_manager::create_rep ()) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
88 { } |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
89 |
17998
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
90 // The following is a workaround for an apparent bug in GCC 4.1.2 and |
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
91 // possibly earlier versions. See Octave bug report #30685 for details. |
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
92 #if defined (__GNUC__) |
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
93 # if ! (__GNUC__ > 4 \ |
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
94 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 1 \ |
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
95 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 2)))) |
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
96 # undef GNULIB_NAMESPACE |
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
97 # define GNULIB_NAMESPACE |
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
98 # warning "disabling GNULIB_NAMESPACE for signal functions -- consider upgrading to a current version of GCC" |
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
99 # endif |
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
100 #endif |
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
101 |
17922
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
102 static void |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
103 block_or_unblock_signal (int how, int sig) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
104 { |
17971
54784619350b
Make CTRL-C to work in GUI with "system" calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17958
diff
changeset
|
105 #if ! defined (__WIN32__) || defined (__CYGWIN__) |
54784619350b
Make CTRL-C to work in GUI with "system" calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17958
diff
changeset
|
106 // Blocking/unblocking signals at thread level is only supported |
54784619350b
Make CTRL-C to work in GUI with "system" calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17958
diff
changeset
|
107 // on platform with fully compliant POSIX threads. This is not |
54784619350b
Make CTRL-C to work in GUI with "system" calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17958
diff
changeset
|
108 // supported on Win32. Moreover, we have to make sure that SIGINT |
54784619350b
Make CTRL-C to work in GUI with "system" calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17958
diff
changeset
|
109 // handler is not installed before calling AllocConsole: installing |
54784619350b
Make CTRL-C to work in GUI with "system" calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17958
diff
changeset
|
110 // a SIGINT handler internally calls SetConsoleCtrlHandler, which |
54784619350b
Make CTRL-C to work in GUI with "system" calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17958
diff
changeset
|
111 // must be called after AllocConsole to be effective. |
54784619350b
Make CTRL-C to work in GUI with "system" calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17958
diff
changeset
|
112 |
17922
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
113 sigset_t signal_mask; |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
114 |
17998
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
115 GNULIB_NAMESPACE::sigemptyset (&signal_mask); |
17922
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
116 |
17998
f82fd6854dbf
use gnulib sigemptyset and sigaddset in thread_manager class
John W. Eaton <jwe@octave.org>
parents:
17971
diff
changeset
|
117 GNULIB_NAMESPACE::sigaddset (&signal_mask, sig); |
17922
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
118 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
119 pthread_sigmask (how, &signal_mask, 0); |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
120 #endif |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
121 } |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
122 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
123 void |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
124 octave_thread_manager::block_interrupt_signal (void) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
125 { |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
126 block_or_unblock_signal (SIG_BLOCK, SIGINT); |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
127 } |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
128 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
129 void |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
130 octave_thread_manager::unblock_interrupt_signal (void) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
131 { |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
132 block_or_unblock_signal (SIG_UNBLOCK, SIGINT); |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
133 } |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
134 |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
135 octave_base_thread_manager * |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
136 octave_thread_manager::create_rep (void) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
137 { |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
138 #if defined (__WIN32__) && ! defined (__CYGWIN__) |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
139 return new windows_thread_manager (); |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
140 #else |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
141 return new pthread_thread_manager (); |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
142 #endif |
b5bf26a054bd
interrupt interpreter thread in GUI instead of calling "raise (SIGINT)"
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
143 } |