1228904Sed/*-
2228904Sed * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
3228904Sed * All rights reserved.
4228904Sed *
5228904Sed * Redistribution and use in source and binary forms, with or without
6228904Sed * modification, are permitted provided that the following conditions
7228904Sed * are met:
8228904Sed * 1. Redistributions of source code must retain the above copyright
9228904Sed *    notice, this list of conditions and the following disclaimer.
10228904Sed * 2. Redistributions in binary form must reproduce the above copyright
11228904Sed *    notice, this list of conditions and the following disclaimer in the
12228904Sed *    documentation and/or other materials provided with the distribution.
13228904Sed *
14228904Sed * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15228904Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16228904Sed * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17228904Sed * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18228904Sed * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19228904Sed * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20228904Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21228904Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22228904Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23228904Sed * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24228904Sed * SUCH DAMAGE.
25228904Sed *
26228904Sed * $FreeBSD: releng/10.3/lib/libstdthreads/call_once.c 228904 2011-12-26 21:51:53Z ed $
27228904Sed */
28228904Sed
29228904Sed#include <sys/cdefs.h>
30228904Sed__FBSDID("$FreeBSD: releng/10.3/lib/libstdthreads/call_once.c 228904 2011-12-26 21:51:53Z ed $");
31228904Sed
32228904Sed#include <pthread.h>
33228904Sed
34228904Sed#include "threads.h"
35228904Sed
36228904Sedvoid
37228904Sedcall_once(once_flag *flag, void (*func)(void))
38228904Sed{
39228904Sed
40228904Sed	(void)pthread_once((pthread_once_t *)flag, func);
41228904Sed}
42228904Sed
43228904Sed_Static_assert(sizeof(once_flag) == sizeof(pthread_once_t),
44228904Sed    "once_flag must be of the same size as pthread_once_t");
45