/*
 * $Id: pthread-init.h,v 1.3 2000/09/22 22:05:18 k-abe Exp $
 *
 * This file is part of PTL, Portable Thread Library.
 *
 * Copyright (C) 1999-2000 Kota Abe
 *
 */

#ifndef __PTL_SYS_PTHREAD_INIT_H__
#define __PTL_SYS_PTHREAD_INIT_H__

#ifndef PTL_INTERNAL

#include <sys/pthread-cdecl.h>
#include <sys/pthread-extsym.h>

/*
 * Initialize the PTL
 */
# if defined(__GNUC__)
#  if defined(NEED_EXPLICIT_INIT)
#   if defined(__cplusplus)
#     warning "I cannot guarantee that PTL is initialized before calling C++ constructors on this system."
#   endif
__PTL_BEGIN_DECLS
extern void _pthread_init __PTL_NOARGS;
__PTL_END_DECLS

static void _pthread_inithook __PTL_NOARGS __attribute__((constructor));
static void _pthread_inithook __PTL_NOARGS { _pthread_init(); }
#  endif
# else
#  define main __pthread_main
# endif /*!__GNUC__*/
#endif /*!PTL_INTERNAL*/

#endif /* __PTL_SYS_PTHREAD_INIT_H__ */
