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
832d5a6d
Commit
832d5a6d
authored
Jul 08, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fingerprinter: remove mutex only ever used by one thread
parent
488bcb3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
18 deletions
+6
-18
modules/misc/fingerprinter.c
modules/misc/fingerprinter.c
+6
-18
No files found.
modules/misc/fingerprinter.c
View file @
832d5a6d
...
@@ -46,9 +46,12 @@ struct fingerprinter_sys_t
...
@@ -46,9 +46,12 @@ struct fingerprinter_sys_t
{
{
vlc_array_t
*
queue
;
vlc_array_t
*
queue
;
vlc_mutex_t
lock
;
vlc_mutex_t
lock
;
}
incoming
,
processing
,
results
;
}
incoming
,
results
;
vlc_cond_t
incoming_queue_filled
;
struct
{
vlc_array_t
*
queue
;
}
processing
;
struct
struct
{
{
...
@@ -93,7 +96,6 @@ static void EnqueueRequest( fingerprinter_thread_t *f, fingerprint_request_t *r
...
@@ -93,7 +96,6 @@ static void EnqueueRequest( fingerprinter_thread_t *f, fingerprint_request_t *r
vlc_mutex_lock
(
&
p_sys
->
incoming
.
lock
);
vlc_mutex_lock
(
&
p_sys
->
incoming
.
lock
);
vlc_array_append
(
p_sys
->
incoming
.
queue
,
r
);
vlc_array_append
(
p_sys
->
incoming
.
queue
,
r
);
vlc_mutex_unlock
(
&
p_sys
->
incoming
.
lock
);
vlc_mutex_unlock
(
&
p_sys
->
incoming
.
lock
);
vlc_cond_signal
(
&
p_sys
->
incoming_queue_filled
);
}
}
static
void
QueueIncomingRequests
(
fingerprinter_sys_t
*
p_sys
)
static
void
QueueIncomingRequests
(
fingerprinter_sys_t
*
p_sys
)
...
@@ -101,12 +103,10 @@ static void QueueIncomingRequests( fingerprinter_sys_t *p_sys )
...
@@ -101,12 +103,10 @@ static void QueueIncomingRequests( fingerprinter_sys_t *p_sys )
vlc_mutex_lock
(
&
p_sys
->
incoming
.
lock
);
vlc_mutex_lock
(
&
p_sys
->
incoming
.
lock
);
int
i
=
vlc_array_count
(
p_sys
->
incoming
.
queue
);
int
i
=
vlc_array_count
(
p_sys
->
incoming
.
queue
);
if
(
i
==
0
)
goto
end
;
if
(
i
==
0
)
goto
end
;
vlc_mutex_lock
(
&
p_sys
->
processing
.
lock
);
while
(
i
)
while
(
i
)
vlc_array_append
(
p_sys
->
processing
.
queue
,
vlc_array_append
(
p_sys
->
processing
.
queue
,
vlc_array_item_at_index
(
p_sys
->
incoming
.
queue
,
--
i
)
);
vlc_array_item_at_index
(
p_sys
->
incoming
.
queue
,
--
i
)
);
vlc_array_clear
(
p_sys
->
incoming
.
queue
);
vlc_array_clear
(
p_sys
->
incoming
.
queue
);
vlc_mutex_unlock
(
&
p_sys
->
processing
.
lock
);
end:
end:
vlc_mutex_unlock
(
&
p_sys
->
incoming
.
lock
);
vlc_mutex_unlock
(
&
p_sys
->
incoming
.
lock
);
}
}
...
@@ -247,10 +247,8 @@ static int Open(vlc_object_t *p_this)
...
@@ -247,10 +247,8 @@ static int Open(vlc_object_t *p_this)
p_sys
->
incoming
.
queue
=
vlc_array_new
();
p_sys
->
incoming
.
queue
=
vlc_array_new
();
vlc_mutex_init
(
&
p_sys
->
incoming
.
lock
);
vlc_mutex_init
(
&
p_sys
->
incoming
.
lock
);
vlc_cond_init
(
&
p_sys
->
incoming_queue_filled
);
p_sys
->
processing
.
queue
=
vlc_array_new
();
p_sys
->
processing
.
queue
=
vlc_array_new
();
vlc_mutex_init
(
&
p_sys
->
processing
.
lock
);
p_sys
->
results
.
queue
=
vlc_array_new
();
p_sys
->
results
.
queue
=
vlc_array_new
();
vlc_mutex_init
(
&
p_sys
->
results
.
lock
);
vlc_mutex_init
(
&
p_sys
->
results
.
lock
);
...
@@ -298,12 +296,10 @@ static void Close(vlc_object_t *p_this)
...
@@ -298,12 +296,10 @@ static void Close(vlc_object_t *p_this)
fingerprint_request_Delete
(
vlc_array_item_at_index
(
p_sys
->
incoming
.
queue
,
i
)
);
fingerprint_request_Delete
(
vlc_array_item_at_index
(
p_sys
->
incoming
.
queue
,
i
)
);
vlc_array_destroy
(
p_sys
->
incoming
.
queue
);
vlc_array_destroy
(
p_sys
->
incoming
.
queue
);
vlc_mutex_destroy
(
&
p_sys
->
incoming
.
lock
);
vlc_mutex_destroy
(
&
p_sys
->
incoming
.
lock
);
vlc_cond_destroy
(
&
p_sys
->
incoming_queue_filled
);
for
(
int
i
=
0
;
i
<
vlc_array_count
(
p_sys
->
processing
.
queue
);
i
++
)
for
(
int
i
=
0
;
i
<
vlc_array_count
(
p_sys
->
processing
.
queue
);
i
++
)
fingerprint_request_Delete
(
vlc_array_item_at_index
(
p_sys
->
processing
.
queue
,
i
)
);
fingerprint_request_Delete
(
vlc_array_item_at_index
(
p_sys
->
processing
.
queue
,
i
)
);
vlc_array_destroy
(
p_sys
->
processing
.
queue
);
vlc_array_destroy
(
p_sys
->
processing
.
queue
);
vlc_mutex_destroy
(
&
p_sys
->
processing
.
lock
);
for
(
int
i
=
0
;
i
<
vlc_array_count
(
p_sys
->
results
.
queue
);
i
++
)
for
(
int
i
=
0
;
i
<
vlc_array_count
(
p_sys
->
results
.
queue
);
i
++
)
fingerprint_request_Delete
(
vlc_array_item_at_index
(
p_sys
->
results
.
queue
,
i
)
);
fingerprint_request_Delete
(
vlc_array_item_at_index
(
p_sys
->
results
.
queue
,
i
)
);
...
@@ -343,16 +339,10 @@ static void Run( fingerprinter_thread_t *p_fingerprinter )
...
@@ -343,16 +339,10 @@ static void Run( fingerprinter_thread_t *p_fingerprinter )
/* main loop */
/* main loop */
for
(;;)
for
(;;)
{
{
vlc_mutex_lock
(
&
p_sys
->
processing
.
lock
);
msleep
(
CLOCK_FREQ
);
mutex_cleanup_push
(
&
p_sys
->
processing
.
lock
);
vlc_cond_timedwait
(
&
p_sys
->
incoming_queue_filled
,
&
p_sys
->
processing
.
lock
,
mdate
()
+
1000000
);
vlc_cleanup_run
();
QueueIncomingRequests
(
p_sys
);
QueueIncomingRequests
(
p_sys
);
vlc_mutex_lock
(
&
p_sys
->
processing
.
lock
);
// L0
mutex_cleanup_push
(
&
p_sys
->
processing
.
lock
);
//**
for
(
p_sys
->
i
=
0
;
p_sys
->
i
<
vlc_array_count
(
p_sys
->
processing
.
queue
);
p_sys
->
i
++
)
for
(
p_sys
->
i
=
0
;
p_sys
->
i
<
vlc_array_count
(
p_sys
->
processing
.
queue
);
p_sys
->
i
++
)
{
{
fingerprint_request_t
*
p_data
=
vlc_array_item_at_index
(
p_sys
->
processing
.
queue
,
p_sys
->
i
);
fingerprint_request_t
*
p_data
=
vlc_array_item_at_index
(
p_sys
->
processing
.
queue
,
p_sys
->
i
);
...
@@ -397,7 +387,5 @@ static void Run( fingerprinter_thread_t *p_fingerprinter )
...
@@ -397,7 +387,5 @@ static void Run( fingerprinter_thread_t *p_fingerprinter )
var_TriggerCallback
(
p_fingerprinter
,
"results-available"
);
var_TriggerCallback
(
p_fingerprinter
,
"results-available"
);
vlc_array_clear
(
p_sys
->
processing
.
queue
);
vlc_array_clear
(
p_sys
->
processing
.
queue
);
}
}
//**
vlc_cleanup_run
();
// L0
}
}
}
}
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