source: rtems/cpukit/posix/src/pthreadonce.c @ 47b1e31

5
Last change on this file since 47b1e31 was 47b1e31, checked in by Sebastian Huber <sebastian.huber@…>, on 09/19/17 at 12:10:33

posix: Optimize pthread_once_t

Reduce size of pthread_once_t and make it zero-initialized.

Update #3142.

  • Property mode set to 100644
File size: 777 bytes
Line 
1/**
2 * @file
3 *
4 * @brief Call to function by Thread will call init_routine with no Arguments
5 * @ingroup POSIXAPI
6 */
7
8/*
9 *  16.1.8 Dynamic Package Initialization, P1003.1c/Draft 10, p. 154
10 *
11 *  COPYRIGHT (c) 1989-1999.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#if HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <pthread.h>
24#include <errno.h>
25
26#include <rtems/score/onceimpl.h>
27
28int pthread_once(
29  pthread_once_t  *once_control,
30  void           (*init_routine)(void)
31)
32{
33  if ( !once_control || !init_routine )
34    return EINVAL;
35
36  return _Once( &once_control->_flags, init_routine );
37}
Note: See TracBrowser for help on using the repository browser.