Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
0efa83ac
Commit
0efa83ac
authored
May 29, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
signal handling interface
parent
19091cce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
1 deletion
+137
-1
configure.ac
configure.ac
+1
-0
modules/control/Modules.am
modules/control/Modules.am
+1
-1
modules/control/signals.c
modules/control/signals.c
+135
-0
No files found.
configure.ac
View file @
0efa83ac
...
...
@@ -1320,6 +1320,7 @@ if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
VLC_ADD_PLUGIN([screensaver])
VLC_ADD_PLUGIN([motion])
VLC_ADD_PLUGIN([dynamicoverlay])
VLC_ADD_PLUGIN([signals])
elif test "${SYS}" != "mingwce"; then
VLC_ADD_PLUGIN([ntservice])
VLC_ADD_PLUGIN([access_smb])
...
...
modules/control/Modules.am
View file @
0efa83ac
...
...
@@ -8,6 +8,7 @@ SOURCES_hotkeys = hotkeys.c
SOURCES_lirc = lirc.c
SOURCES_rc = rc.c
SOURCES_dbus = dbus.c dbus.h
SOURCES_signals = signals.c
if HAVE_DARWIN
motion_extra = unimotion.c unimotion.h
else
...
...
@@ -17,4 +18,3 @@ SOURCES_motion = \
motion.c \
$(motion_extra) \
$(NULL)
modules/control/signals.c
0 → 100644
View file @
0efa83ac
/*****************************************************************************
* signals.c : signals handler module for vlc
*****************************************************************************
* Copyright (C) 2008 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <pthread.h>
#include <signal.h>
#include <time.h>
#include <vlc/vlc.h>
#include <vlc_plugin.h>
#include <vlc_interface.h>
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Run
(
intf_thread_t
*
);
static
void
*
SigThread
(
void
*
);
vlc_module_begin
();
set_shortname
(
N_
(
"Signals"
));
set_category
(
CAT_INTERFACE
);
set_subcategory
(
SUBCAT_INTERFACE_CONTROL
);
set_description
(
N_
(
"POSIX signals handling interface"
));
set_capability
(
"interface"
,
0
);
set_callbacks
(
Open
,
Close
);
vlc_module_end
();
struct
intf_sys_t
{
pthread_t
thread
;
int
signum
;
};
static
int
Open
(
vlc_object_t
*
obj
)
{
intf_thread_t
*
intf
=
(
intf_thread_t
*
)
obj
;
intf_sys_t
*
p_sys
=
malloc
(
sizeof
(
*
p_sys
));
if
(
p_sys
==
NULL
)
return
VLC_ENOMEM
;
p_sys
->
signum
=
0
;
intf
->
p_sys
=
p_sys
;
if
(
pthread_create
(
&
p_sys
->
thread
,
NULL
,
SigThread
,
obj
))
{
free
(
p_sys
);
intf
->
p_sys
=
NULL
;
return
VLC_ENOMEM
;
}
intf
->
pf_run
=
Run
;
return
0
;
}
static
void
Close
(
vlc_object_t
*
obj
)
{
intf_thread_t
*
intf
=
(
intf_thread_t
*
)
obj
;
intf_sys_t
*
p_sys
=
intf
->
p_sys
;
pthread_cancel
(
p_sys
->
thread
);
pthread_join
(
p_sys
->
thread
,
NULL
);
free
(
p_sys
);
}
static
void
*
SigThread
(
void
*
data
)
{
intf_thread_t
*
obj
=
data
;
intf_sys_t
*
p_sys
=
obj
->
p_sys
;
sigset_t
set
;
sigemptyset
(
&
set
);
sigaddset
(
&
set
,
SIGHUP
);
sigaddset
(
&
set
,
SIGINT
);
sigaddset
(
&
set
,
SIGQUIT
);
sigaddset
(
&
set
,
SIGTERM
);
sigaddset
(
&
set
,
SIGCHLD
);
for
(;;)
{
int
signum
;
sigwait
(
&
set
,
&
signum
);
vlc_object_lock
(
obj
);
p_sys
->
signum
=
signum
;
vlc_object_signal_unlocked
(
obj
);
vlc_object_unlock
(
obj
);
}
}
static
void
Run
(
intf_thread_t
*
obj
)
{
intf_sys_t
*
p_sys
=
obj
->
p_sys
;
vlc_object_lock
(
obj
);
do
{
switch
(
p_sys
->
signum
)
{
case
SIGINT
:
case
SIGHUP
:
case
SIGTERM
:
case
SIGQUIT
:
msg_Err
(
obj
,
"Caught %s signal, exiting..."
,
strsignal
(
p_sys
->
signum
));
goto
out
;
}
}
while
(
!
vlc_object_wait
(
obj
));
out:
vlc_object_unlock
(
obj
);
vlc_object_kill
(
obj
->
p_libvlc
);
}
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