Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
39eb5768
Commit
39eb5768
authored
Dec 10, 2000
by
Benoit Steiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixe la gestion des signaux
parent
53c2e3ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
11 deletions
+33
-11
src/interface/main.c
src/interface/main.c
+33
-11
No files found.
src/interface/main.c
View file @
39eb5768
...
...
@@ -39,6 +39,7 @@
#include <string.h>
/* strerror() */
#include "config.h"
#include "debug.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
...
...
@@ -159,7 +160,8 @@ static void Usage ( int i_fashion );
static
void
Version
(
void
);
static
void
InitSignalHandler
(
void
);
static
void
SignalHandler
(
int
i_signal
);
static
void
SimpleSignalHandler
(
int
i_signal
);
static
void
FatalSignalHandler
(
int
i_signal
);
#ifdef HAVE_MMX
int
TestMMX
(
void
);
#endif
...
...
@@ -210,6 +212,11 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
return
(
errno
);
}
/*
* Set signal handling policy up for all the threads that will be created
*/
InitSignalHandler
();
/* prepare signals for interception */
/*
* Read configuration
*/
...
...
@@ -278,8 +285,6 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
p_main
->
p_intf
=
intf_Create
();
if
(
p_main
->
p_intf
!=
NULL
)
{
InitSignalHandler
();
/* prepare signals for interception */
/*
* This is the main loop
*/
...
...
@@ -721,18 +726,35 @@ static void Version( void )
static
void
InitSignalHandler
(
void
)
{
/* Termination signals */
signal
(
SIGHUP
,
SignalHandler
);
signal
(
SIGINT
,
SignalHandler
);
signal
(
SIGQUIT
,
SignalHandler
);
signal
(
SIGHUP
,
FatalSignalHandler
);
signal
(
SIGINT
,
FatalSignalHandler
);
signal
(
SIGQUIT
,
FatalSignalHandler
);
/* Other signals */
signal
(
SIGALRM
,
SimpleSignalHandler
);
signal
(
SIGPIPE
,
SimpleSignalHandler
);
}
/*****************************************************************************
* SimpleSignalHandler: system signal handler
*****************************************************************************
* This function is called when a non fatal signal is received by the program.
*****************************************************************************/
static
void
SimpleSignalHandler
(
int
i_signal
)
{
/* Acknowledge the signal received */
intf_WarnMsg
(
0
,
"intf: ignoring signal %d
\n
"
,
i_signal
);
}
/*****************************************************************************
* SignalHandler: system signal handler
*
Fatal
SignalHandler: system signal handler
*****************************************************************************
* This function is called when a
signal is received by the program. It tries to
* end the program in a clean way.
* This function is called when a
fatal signal is received by the program.
*
It tries to
end the program in a clean way.
*****************************************************************************/
static
void
SignalHandler
(
int
i_signal
)
static
void
Fatal
SignalHandler
(
int
i_signal
)
{
/* Once a signal has been trapped, the termination sequence will be armed and
* following signals will be ignored to avoid sending messages to an interface
...
...
@@ -742,7 +764,7 @@ static void SignalHandler( int i_signal )
signal
(
SIGQUIT
,
SIG_IGN
);
/* Acknowledge the signal received */
intf_ErrMsgImm
(
"intf: signal %d received
\n
"
,
i_signal
);
intf_ErrMsgImm
(
"intf: signal %d received
, exiting
\n
"
,
i_signal
);
/* Try to terminate everything - this is done by requesting the end of the
* interface thread */
...
...
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