Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
a09b86ce
Commit
a09b86ce
authored
Nov 10, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Privatize b_die
parent
32303b5d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
16 deletions
+19
-16
include/vlc_common.h
include/vlc_common.h
+0
-1
include/vlc_objects.h
include/vlc_objects.h
+1
-7
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/misc/objects.c
src/misc/objects.c
+16
-8
src/misc/variables.h
src/misc/variables.h
+1
-0
No files found.
include/vlc_common.h
View file @
a09b86ce
...
...
@@ -453,7 +453,6 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *, /* variable's object */
int i_flags; \
\
/* Object properties */
\
volatile bool b_die;
/**< set by the outside */
\
bool b_force;
/**< set by the outside (eg. module_need()) */
\
\
/* Stuff related to the libvlc structure */
\
...
...
include/vlc_objects.h
View file @
a09b86ce
...
...
@@ -73,13 +73,7 @@ VLC_API char *vlc_object_get_name( const vlc_object_t * ) VLC_USED;
vlc_list_children( VLC_OBJECT(a) )
/* Objects and threading */
VLC_USED
VLC_DEPRECATED
static
inline
bool
vlc_object_alive
(
const
vlc_object_t
*
obj
)
{
barrier
();
return
!
obj
->
b_die
;
}
VLC_API
VLC_USED
VLC_DEPRECATED
bool
vlc_object_alive
(
vlc_object_t
*
);
#define vlc_object_alive(a) vlc_object_alive( VLC_OBJECT(a) )
/** @} */
src/libvlccore.sym
View file @
a09b86ce
...
...
@@ -556,6 +556,7 @@ vlc_object_find_name
vlc_object_hold
vlc_object_release
vlc_object_get_name
vlc_object_alive
vlc_rand_bytes
vlc_drand48
vlc_lrand48
...
...
src/misc/objects.c
View file @
a09b86ce
...
...
@@ -133,6 +133,7 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length,
vlc_mutex_init
(
&
priv
->
var_lock
);
vlc_cond_init
(
&
priv
->
var_wait
);
priv
->
pipes
[
0
]
=
priv
->
pipes
[
1
]
=
-
1
;
atomic_init
(
&
priv
->
alive
,
true
);
atomic_init
(
&
priv
->
refs
,
1
);
priv
->
pf_destructor
=
NULL
;
priv
->
prev
=
NULL
;
...
...
@@ -141,7 +142,6 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length,
vlc_object_t
*
obj
=
(
vlc_object_t
*
)(
priv
+
1
);
obj
->
psz_object_type
=
typename
;
obj
->
psz_header
=
NULL
;
obj
->
b_die
=
false
;
obj
->
b_force
=
false
;
memset
(
obj
+
1
,
0
,
length
-
sizeof
(
*
obj
));
/* type-specific stuff */
...
...
@@ -367,7 +367,7 @@ int vlc_object_waitpipe( vlc_object_t *obj )
internals
->
pipes
[
0
]
=
internals
->
pipes
[
1
]
=
-
1
;
}
if
(
internals
->
pipes
[
0
]
!=
-
1
&&
obj
->
b_die
)
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
));
...
...
@@ -388,16 +388,13 @@ void vlc_object_kill( vlc_object_t *p_this )
vlc_object_internals_t
*
priv
=
vlc_internals
(
p_this
);
int
fd
=
-
1
;
vlc_mutex_lock
(
&
pipe_lock
);
if
(
!
p_this
->
b_die
)
if
(
atomic_exchange
(
&
priv
->
alive
,
false
))
{
vlc_mutex_lock
(
&
pipe_lock
);
fd
=
priv
->
pipes
[
1
];
p_this
->
b_die
=
true
;
vlc_mutex_unlock
(
&
pipe_lock
)
;
}
/* This also serves as a memory barrier toward vlc_object_alive(): */
vlc_mutex_unlock
(
&
pipe_lock
);
if
(
fd
!=
-
1
)
{
int
canc
=
vlc_savecancel
();
...
...
@@ -512,6 +509,17 @@ void vlc_object_release( vlc_object_t *p_this )
}
}
#undef vlc_object_alive
/**
* This function returns true, except when it returns false.
* \warning Do not use this function. Ever. You were warned.
*/
bool
vlc_object_alive
(
vlc_object_t
*
obj
)
{
vlc_object_internals_t
*
internals
=
vlc_internals
(
obj
);
return
atomic_load
(
&
internals
->
alive
);
}
#undef vlc_list_children
/**
* Gets the list of children of an objects, and increment their reference
...
...
src/misc/variables.h
View file @
a09b86ce
...
...
@@ -41,6 +41,7 @@ struct vlc_object_internals
/* Objects thread synchronization */
int
pipes
[
2
];
atomic_bool
alive
;
/* Objects management */
atomic_uint
refs
;
...
...
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