Skip to content

Commit f148a90

Browse files
committed
vcap/testcard2: use pthread_equal
Instead of fragile comparison of (in general) opaque pthread_t, use pthread_equal.
1 parent 15a9056 commit f148a90

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/video_capture/testcard2.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,7 @@ static void vidcap_testcard2_done(void *state)
423423
pthread_mutex_unlock(&s->lock);
424424
pthread_cond_signal(&s->data_consumed_cv);
425425

426-
pthread_t null_thread_id;
427-
memset(&null_thread_id, 0, sizeof null_thread_id); // for safe memcmp
428-
null_thread_id = PTHREAD_NULL;
429-
if (memcmp(&s->thread_id, &null_thread_id, sizeof s->thread_id) != 0) {
426+
if (!pthread_equal(s->thread_id, PTHREAD_NULL)) {
430427
pthread_join(s->thread_id, NULL);
431428
}
432429

0 commit comments

Comments
 (0)