Module Name:    src
Committed By:   kamil
Date:           Wed Apr 24 21:41:15 UTC 2019

Modified Files:
        src/lib/libpthread: call_once.c

Log Message:
Drop error path from C11 call_once

The original implementation of C11 threads(3) contained check for error
paths, but it was stripped in the calls that are documented to return
no status from an operation. Do the same in call_once(3).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libpthread/call_once.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread/call_once.c
diff -u src/lib/libpthread/call_once.c:1.1 src/lib/libpthread/call_once.c:1.2
--- src/lib/libpthread/call_once.c:1.1	Wed Apr 24 11:43:19 2019
+++ src/lib/libpthread/call_once.c	Wed Apr 24 21:41:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: call_once.c,v 1.1 2019/04/24 11:43:19 kamil Exp $	*/
+/*	$NetBSD: call_once.c,v 1.2 2019/04/24 21:41:15 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,12 +30,10 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: call_once.c,v 1.1 2019/04/24 11:43:19 kamil Exp $");
+__RCSID("$NetBSD: call_once.c,v 1.2 2019/04/24 21:41:15 kamil Exp $");
 
 #include <assert.h>
-#include <err.h>
 #include <pthread.h>
-#include <stdlib.h>
 #include <threads.h>
 
 void
@@ -45,8 +43,8 @@ call_once(once_flag *flag, void (*func)(
 	_DIAGASSERT(flag != NULL);
 	_DIAGASSERT(func != NULL);
 
-	/* The call_once(3) function returns no value, this forces this code to
-	 * break as there is nothing better available. */
-	if (pthread_once(flag, func) != 0)
-		errx(EXIT_FAILURE, "pthread_once failed");
+	/*
+	 * The call_once(3) function that conforms to C11 returns no value.
+	 */
+	(void)pthread_once(flag, func);
 }

Reply via email to