source: rtems/cpukit/posix/src/pthreadonce.c @ a5385b1

4.115
Last change on this file since a5385b1 was a5385b1, checked in by Christian Mauderer <Christian.Mauderer@…>, on 03/20/14 at 08:22:00

score: Unify pthread and gxx_wrapper once and move to score.

  • Property mode set to 100644
File size: 847 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  if ( once_control->is_initialized != 1 )
37    return EINVAL;
38
39  return _Once( &once_control->init_executed, init_routine );
40}
Note: See TracBrowser for help on using the repository browser.