Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita40646e

Browse files
committed
Fix error handling in replacement pthread_barrier_init().
Commit44bf3d5 incorrectly used an errno-style interface when supplyingmissing pthread functionality (i.e. on macOS), but it should check forand return error numbers directly.
1 parent7c544ec commita40646e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

‎src/port/pthread_barrier_wait.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,17 @@
1818
int
1919
pthread_barrier_init(pthread_barrier_t*barrier,constvoid*attr,intcount)
2020
{
21+
interror;
22+
2123
barrier->sense= false;
2224
barrier->count=count;
2325
barrier->arrived=0;
24-
if (pthread_cond_init(&barrier->cond,NULL)<0)
25-
return-1;
26-
if (pthread_mutex_init(&barrier->mutex,NULL)<0)
26+
if ((error=pthread_cond_init(&barrier->cond,NULL))!=0)
27+
returnerror;
28+
if ((error=pthread_mutex_init(&barrier->mutex,NULL))!=0)
2729
{
28-
intsave_errno=errno;
29-
3030
pthread_cond_destroy(&barrier->cond);
31-
errno=save_errno;
32-
33-
return-1;
31+
returnerror;
3432
}
3533

3634
return0;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp