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
1ae21d47
Commit
1ae21d47
authored
Apr 16, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid problems with srand() and speed up a bit (avoid dlsym)
parent
e453dbc3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
bin/override.c
bin/override.c
+11
-7
No files found.
bin/override.c
View file @
1ae21d47
...
...
@@ -148,24 +148,28 @@ int unsetenv (const char *name)
* preserve reproducibility of the number sequence (which usually does not
* matter).
**/
static
pthread_mutex_t
prng_lock
=
PTHREAD_MUTEX_INITIALIZER
;
static
struct
{
pthread_mutex_t
lock
;
unsigned
int
seed
;
}
prng
=
{
PTHREAD_MUTEX_INITIALIZER
,
0
,
};
void
srand
(
unsigned
int
seed
)
{
pthread_mutex_lock
(
&
prng
_
lock
);
pthread_mutex_lock
(
&
prng
.
lock
);
LOG
(
"Warning"
,
"%d"
,
seed
);
CALL
(
srand
,
seed
)
;
pthread_mutex_unlock
(
&
prng
_
lock
);
prng
.
seed
=
seed
;
pthread_mutex_unlock
(
&
prng
.
lock
);
}
int
rand
(
void
)
{
int
ret
;
pthread_mutex_lock
(
&
prng
_
lock
);
pthread_mutex_lock
(
&
prng
.
lock
);
LOG
(
"Warning"
,
""
);
ret
=
CALL
(
ran
d
);
pthread_mutex_unlock
(
&
prng
_
lock
);
ret
=
rand_r
(
&
prng
.
see
d
);
pthread_mutex_unlock
(
&
prng
.
lock
);
return
ret
;
}
...
...
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