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
a117a662
Commit
a117a662
authored
Jun 30, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
objects: remove vlc_object_waitpipe()
parent
f3b589be
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
138 deletions
+1
-138
src/libvlc.h
src/libvlc.h
+0
-1
src/misc/objects.c
src/misc/objects.c
+1
-136
src/misc/variables.h
src/misc/variables.h
+0
-1
No files found.
src/libvlc.h
View file @
a117a662
...
...
@@ -57,7 +57,6 @@ void vlc_CPU_dump(vlc_object_t *);
/* This cannot be used as is from plugins yet: */
int
vlc_clone_detach
(
vlc_thread_t
*
,
void
*
(
*
)(
void
*
),
void
*
,
int
);
int
vlc_object_waitpipe
(
vlc_object_t
*
obj
);
void
ObjectKillChildrens
(
vlc_object_t
*
);
int
vlc_set_priority
(
vlc_thread_t
,
int
);
...
...
src/misc/objects.c
View file @
a117a662
...
...
@@ -52,36 +52,9 @@
# include <search.h>
#endif
#ifdef __OS2__
# include <sys/socket.h>
# include <netinet/in.h>
# include <unistd.h> // close(), write()
#elif defined(_WIN32)
# include <io.h>
# include <winsock2.h>
# include <ws2tcpip.h>
# undef read
# define read( a, b, c ) recv (a, b, c, 0)
# undef write
# define write( a, b, c ) send (a, b, c, 0)
# undef close
# define close( a ) closesocket (a)
#else
# include <vlc_fs.h>
# include <unistd.h>
#endif
#include <limits.h>
#include <assert.h>
#if defined (HAVE_SYS_EVENTFD_H)
# include <sys/eventfd.h>
# ifndef EFD_CLOEXEC
# define EFD_CLOEXEC 0
# warning EFD_CLOEXEC missing. Consider updating libc.
# endif
#endif
/*****************************************************************************
* Local prototypes
...
...
@@ -132,7 +105,6 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length,
priv
->
var_root
=
NULL
;
vlc_mutex_init
(
&
priv
->
var_lock
);
vlc_cond_init
(
&
priv
->
var_wait
);
priv
->
pipes
[
0
]
=
priv
->
pipes
[
1
]
=
-
1
;
atomic_init
(
&
priv
->
refs
,
1
);
priv
->
pf_destructor
=
NULL
;
priv
->
prev
=
NULL
;
...
...
@@ -277,10 +249,6 @@ static void vlc_object_destroy( vlc_object_t *p_this )
free
(
p_priv
->
psz_name
);
if
(
p_priv
->
pipes
[
1
]
!=
-
1
&&
p_priv
->
pipes
[
1
]
!=
p_priv
->
pipes
[
0
]
)
close
(
p_priv
->
pipes
[
1
]
);
if
(
p_priv
->
pipes
[
0
]
!=
-
1
)
close
(
p_priv
->
pipes
[
0
]
);
if
(
VLC_OBJECT
(
p_this
->
p_libvlc
)
==
p_this
)
vlc_mutex_destroy
(
&
(
libvlc_priv
((
libvlc_int_t
*
)
p_this
)
->
structure_lock
));
...
...
@@ -288,97 +256,6 @@ static void vlc_object_destroy( vlc_object_t *p_this )
}
#if defined(_WIN32) || defined(__OS2__)
/**
* select()-able pipes emulated using Winsock
*/
# define vlc_pipe selectable_pipe
static
int
selectable_pipe
(
int
fd
[
2
])
{
struct
sockaddr_in
addr
;
int
addrlen
=
sizeof
(
addr
);
int
l
=
socket
(
PF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
),
c
=
socket
(
PF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
if
(
l
==
-
1
||
c
==
-
1
)
goto
error
;
memset
(
&
addr
,
0
,
sizeof
(
addr
));
addr
.
sin_family
=
AF_INET
;
addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
if
(
bind
(
l
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
||
getsockname
(
l
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
)
||
listen
(
l
,
1
)
||
connect
(
c
,
(
struct
sockaddr
*
)
&
addr
,
addrlen
))
goto
error
;
int
a
=
accept
(
l
,
NULL
,
NULL
);
if
(
a
==
-
1
)
goto
error
;
close
(
l
);
//shutdown (a, 0);
//shutdown (c, 1);
fd
[
0
]
=
c
;
fd
[
1
]
=
a
;
return
0
;
error:
if
(
l
!=
-
1
)
close
(
l
);
if
(
c
!=
-
1
)
close
(
c
);
return
-
1
;
}
#endif
/* _WIN32 || __OS2__ */
static
vlc_mutex_t
pipe_lock
=
VLC_STATIC_MUTEX
;
/**
* Returns the readable end of a pipe that becomes readable once termination
* of the object is requested (vlc_object_kill()).
* This can be used to wake-up out of a select() or poll() event loop, such
* typically when doing network I/O.
*
* Note that the pipe will remain the same for the lifetime of the object.
* DO NOT read the pipe nor close it yourself. Ever.
*
* @param obj object that would be "killed"
* @return a readable pipe descriptor, or -1 on error.
*/
int
vlc_object_waitpipe
(
vlc_object_t
*
obj
)
{
vlc_object_internals_t
*
internals
=
vlc_internals
(
obj
);
vlc_mutex_lock
(
&
pipe_lock
);
if
(
internals
->
pipes
[
0
]
==
-
1
)
{
/* This can only ever happen if someone killed us without locking: */
assert
(
internals
->
pipes
[
1
]
==
-
1
);
/* pipe() is not a cancellation point, but write() is and eventfd() is
* unspecified (not in POSIX). */
int
canc
=
vlc_savecancel
();
#if defined (HAVE_SYS_EVENTFD_H)
internals
->
pipes
[
0
]
=
internals
->
pipes
[
1
]
=
eventfd
(
0
,
EFD_CLOEXEC
);
if
(
internals
->
pipes
[
0
]
==
-
1
)
#endif
{
if
(
vlc_pipe
(
internals
->
pipes
))
internals
->
pipes
[
0
]
=
internals
->
pipes
[
1
]
=
-
1
;
}
if
(
internals
->
pipes
[
0
]
!=
-
1
&&
!
atomic_load
(
&
internals
->
alive
))
{
/* Race condition: vlc_object_kill() already invoked! */
msg_Dbg
(
obj
,
"waitpipe: object already dying"
);
write
(
internals
->
pipes
[
1
],
&
(
uint64_t
){
1
},
sizeof
(
uint64_t
));
}
vlc_restorecancel
(
canc
);
}
vlc_mutex_unlock
(
&
pipe_lock
);
return
internals
->
pipes
[
0
];
}
/**
* Hack for input objects. Should be removed eventually.
*/
...
...
@@ -388,19 +265,7 @@ void ObjectKillChildrens( vlc_object_t *p_obj )
/*if( p_obj == VLC_OBJECT(p_input->p->p_sout) ) return;*/
vlc_object_internals_t
*
priv
=
vlc_internals
(
p_obj
);
if
(
atomic_exchange
(
&
priv
->
alive
,
false
))
{
int
fd
;
vlc_mutex_lock
(
&
pipe_lock
);
fd
=
priv
->
pipes
[
1
];
vlc_mutex_unlock
(
&
pipe_lock
);
if
(
fd
!=
-
1
)
{
write
(
fd
,
&
(
uint64_t
){
1
},
sizeof
(
uint64_t
));
msg_Dbg
(
p_obj
,
"object waitpipe triggered"
);
}
}
atomic_store
(
&
priv
->
alive
,
false
);
vlc_list_t
*
p_list
=
vlc_list_children
(
p_obj
);
for
(
int
i
=
0
;
i
<
p_list
->
i_count
;
i
++
)
...
...
src/misc/variables.h
View file @
a117a662
...
...
@@ -40,7 +40,6 @@ struct vlc_object_internals
vlc_cond_t
var_wait
;
/* Objects thread synchronization */
int
pipes
[
2
];
atomic_bool
alive
;
/* Objects management */
...
...
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