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
754491fc
Commit
754491fc
authored
Jul 30, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
variables: var_IncInteger and var_DecInteger are now atomic.
parent
e533549b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
include/vlc_variables.h
include/vlc_variables.h
+11
-4
src/misc/variables.c
src/misc/variables.c
+4
-0
No files found.
include/vlc_variables.h
View file @
754491fc
...
...
@@ -124,6 +124,11 @@
* \param val Unused
*/
#define VLC_VAR_TOGGLE_BOOL 0x0010
/**
* Increment or decrement an integer of a given value
* \param val the value
*/
#define VLC_VAR_INTEGER_INCDEC 0x0020
/**@}*/
/*****************************************************************************
...
...
@@ -443,8 +448,9 @@ static inline char *__var_GetNonEmptyString( vlc_object_t *p_obj, const char *ps
*/
static
inline
void
__var_IncInteger
(
vlc_object_t
*
p_obj
,
const
char
*
psz_name
)
{
int
i_val
=
__var_GetInteger
(
p_obj
,
psz_name
);
__var_SetInteger
(
p_obj
,
psz_name
,
++
i_val
);
vlc_value_t
val
;
val
.
i_int
=
1
;
__var_GetAndSet
(
p_obj
,
psz_name
,
VLC_VAR_INTEGER_INCDEC
,
val
);
}
#define var_IncInteger(a,b) __var_IncInteger( VLC_OBJECT(a), b )
...
...
@@ -455,8 +461,9 @@ static inline void __var_IncInteger( vlc_object_t *p_obj, const char *psz_name )
*/
static
inline
void
__var_DecInteger
(
vlc_object_t
*
p_obj
,
const
char
*
psz_name
)
{
int
i_val
=
__var_GetInteger
(
p_obj
,
psz_name
);
__var_SetInteger
(
p_obj
,
psz_name
,
--
i_val
);
vlc_value_t
val
;
val
.
i_int
=
-
1
;
__var_GetAndSet
(
p_obj
,
psz_name
,
VLC_VAR_INTEGER_INCDEC
,
val
);
}
#define var_DecInteger(a,b) __var_DecInteger( VLC_OBJECT(a), b )
...
...
src/misc/variables.c
View file @
754491fc
...
...
@@ -704,6 +704,10 @@ int __var_GetAndSet( vlc_object_t *p_this, const char *psz_name, int i_action,
assert
(
(
p_var
->
i_type
&
VLC_VAR_BOOL
)
==
VLC_VAR_BOOL
);
p_var
->
val
.
b_bool
=
!
p_var
->
val
.
b_bool
;
break
;
case
VLC_VAR_INTEGER_INCDEC
:
assert
(
(
p_var
->
i_type
&
VLC_VAR_INTEGER
)
==
VLC_VAR_INTEGER
);
p_var
->
val
.
i_int
+=
val
.
i_int
;
break
;
default:
vlc_mutex_unlock
(
&
p_priv
->
var_lock
);
return
VLC_EGENERIC
;
...
...
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