Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6299d1ee
Commit
6299d1ee
authored
May 31, 1994
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up checking for signals and define intrcheck differently
parent
c50158e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
Modules/signalmodule.c
Modules/signalmodule.c
+14
-6
No files found.
Modules/signalmodule.c
View file @
6299d1ee
...
...
@@ -30,6 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "intrcheck.h"
#include <signal.h>
#include <errno.h>
struct
signalhandler_list
{
int
tripped
;
...
...
@@ -37,6 +38,7 @@ struct signalhandler_list {
};
static
struct
signalhandler_list
sig_list
[
NSIG
];
static
int
tripped
=
0
;
/* Speed up sigcheck() when none tripped */
static
object
*
default_sig_object
;
static
object
*
default_ignore_object
;
...
...
@@ -55,6 +57,7 @@ static RETSIGTYPE
signal_handler
(
sig_num
)
int
sig_num
;
{
tripped
++
;
sig_list
[
sig_num
].
tripped
=
1
;
(
void
*
)
signal
(
sig_num
,
&
signal_handler
);
}
...
...
@@ -148,7 +151,7 @@ initsignal()
sig_list
[
0
].
tripped
=
0
;
for
(
i
=
1
;
i
<
NSIG
;
i
++
)
{
void
*
t
;
/* type cop-out */
RETSIGTYPE
(
*
t
)();
t
=
signal
(
i
,
SIG_IGN
);
signal
(
i
,
t
);
sig_list
[
i
].
tripped
=
0
;
...
...
@@ -313,7 +316,10 @@ int
sigcheck
()
{
int
i
;
object
*
f
=
getframe
();
object
*
f
;
if
(
!
tripped
)
return
0
;
f
=
getframe
();
if
(
f
==
NULL
)
f
=
None
;
for
(
i
=
1
;
i
<
NSIG
;
i
++
)
{
...
...
@@ -334,6 +340,7 @@ sigcheck()
}
}
}
tripped
=
0
;
return
0
;
}
...
...
@@ -348,8 +355,9 @@ initintr()
int
intrcheck
()
{
if
(
!
sigcheck
())
return
0
;
err_clear
();
return
1
;
if
(
sig_list
[
SIGINT
].
tripped
)
{
sig_list
[
SIGINT
].
tripped
=
0
;
return
1
;
}
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment