Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Oleksii Turkot
CrystFEL
Commits
cc22322a
Commit
cc22322a
authored
Jul 13, 2012
by
Thomas White
Browse files
Skeleton signal handler
parent
cb2623e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/indexamajig.c
View file @
cc22322a
...
...
@@ -47,6 +47,7 @@
#include
<pthread.h>
#include
<sys/wait.h>
#include
<fcntl.h>
#include
<signal.h>
#ifdef HAVE_CLOCK_GETTIME
#include
<time.h>
...
...
@@ -671,6 +672,14 @@ static void run_reader(int *stream_pipe_read, int n_proc, FILE *ofh)
}
static
void
signal_handler
(
int
sig
,
siginfo_t
*
si
,
void
*
uc_v
)
{
struct
ucontext_t
*
uc
=
uc_v
;
STATUS
(
"Signal!
\n
"
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
c
;
...
...
@@ -736,6 +745,8 @@ int main(int argc, char *argv[])
int
allDone
;
int
*
finished
;
pid_t
pr
;
struct
sigaction
sa
;
int
r
;
copyme
=
new_copy_hdf5_field_list
();
if
(
copyme
==
NULL
)
{
...
...
@@ -1196,6 +1207,16 @@ int main(int argc, char *argv[])
}
/* Set up signal handler to take action if any children die */
sa
.
sa_flags
=
SA_SIGINFO
|
SA_NOCLDSTOP
;
sigemptyset
(
&
sa
.
sa_mask
);
sa
.
sa_sigaction
=
signal_handler
;
r
=
sigaction
(
SIGCHLD
,
&
sa
,
NULL
);
if
(
r
==
-
1
)
{
ERROR
(
"Failed to set signal handler!
\n
"
);
return
1
;
}
/* Free resources needed by reader only */
if
(
ofh
!=
stdout
)
fclose
(
ofh
);
for
(
i
=
0
;
i
<
n_proc
;
i
++
)
{
...
...
Write
Preview
Supports
Markdown
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