hjl / source-git / glibc

Forked from source-git/glibc 3 years ago
Clone

Blame sysdeps/generic/libc-lock.h

Packit 6c4009
/* libc-internal interface for mutex locks.  Stub version.
Packit 6c4009
   Copyright (C) 1996-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _LIBC_LOCK_H
Packit 6c4009
#define _LIBC_LOCK_H 1
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Define a lock variable NAME with storage class CLASS.  The lock must be
Packit 6c4009
   initialized with __libc_lock_init before it can be used (or define it
Packit 6c4009
   with __libc_lock_define_initialized, below).  Use `extern' for CLASS to
Packit 6c4009
   declare a lock defined in another module.  In public structure
Packit 6c4009
   definitions you must use a pointer to the lock structure (i.e., NAME
Packit 6c4009
   begins with a `*'), because its storage size will not be known outside
Packit 6c4009
   of libc.  */
Packit 6c4009
#define __libc_lock_define(CLASS,NAME)
Packit 6c4009
#define __libc_lock_define_recursive(CLASS,NAME)
Packit 6c4009
#define __rtld_lock_define_recursive(CLASS,NAME)
Packit 6c4009
#define __libc_rwlock_define(CLASS,NAME)
Packit 6c4009
Packit 6c4009
/* Define an initialized lock variable NAME with storage class CLASS.  */
Packit 6c4009
#define __libc_lock_define_initialized(CLASS,NAME)
Packit 6c4009
#define __libc_rwlock_define_initialized(CLASS,NAME)
Packit 6c4009
Packit 6c4009
/* Define an initialized recursive lock variable NAME with storage
Packit 6c4009
   class CLASS.  */
Packit 6c4009
#define __libc_lock_define_initialized_recursive(CLASS,NAME)
Packit 6c4009
#define __rtld_lock_define_initialized_recursive(CLASS,NAME)
Packit 6c4009
Packit 6c4009
/* Initialize the named lock variable, leaving it in a consistent, unlocked
Packit 6c4009
   state.  */
Packit 6c4009
#define __libc_lock_init(NAME)
Packit 6c4009
#define __rtld_lock_initialize(NAME)
Packit 6c4009
#define __libc_rwlock_init(NAME)
Packit 6c4009
Packit 6c4009
/* Same as last but this time we initialize a recursive mutex.  */
Packit 6c4009
#define __libc_lock_init_recursive(NAME)
Packit 6c4009
Packit 6c4009
/* Finalize the named lock variable, which must be locked.  It cannot be
Packit 6c4009
   used again until __libc_lock_init is called again on it.  This must be
Packit 6c4009
   called on a lock variable before the containing storage is reused.  */
Packit 6c4009
#define __libc_lock_fini(NAME)
Packit 6c4009
#define __libc_rwlock_fini(NAME)
Packit 6c4009
Packit 6c4009
/* Finalize recursive named lock.  */
Packit 6c4009
#define __libc_lock_fini_recursive(NAME)
Packit 6c4009
Packit 6c4009
/* Lock the named lock variable.  */
Packit 6c4009
#define __libc_lock_lock(NAME)
Packit 6c4009
#define __libc_rwlock_rdlock(NAME)
Packit 6c4009
#define __libc_rwlock_wrlock(NAME)
Packit 6c4009
Packit 6c4009
/* Lock the recursive named lock variable.  */
Packit 6c4009
#define __libc_lock_lock_recursive(NAME)
Packit 6c4009
#define __rtld_lock_lock_recursive(NAME)
Packit 6c4009
Packit 6c4009
/* Try to lock the named lock variable.  */
Packit 6c4009
#define __libc_lock_trylock(NAME) 0
Packit 6c4009
#define __libc_rwlock_tryrdlock(NAME) 0
Packit 6c4009
#define __libc_rwlock_trywrlock(NAME) 0
Packit 6c4009
Packit 6c4009
/* Try to lock the recursive named lock variable.  */
Packit 6c4009
#define __libc_lock_trylock_recursive(NAME) 0
Packit 6c4009
Packit 6c4009
/* Unlock the named lock variable.  */
Packit 6c4009
#define __libc_lock_unlock(NAME)
Packit 6c4009
#define __libc_rwlock_unlock(NAME)
Packit 6c4009
Packit 6c4009
/* Unlock the recursive named lock variable.  */
Packit 6c4009
#define __libc_lock_unlock_recursive(NAME)
Packit 6c4009
#define __rtld_lock_unlock_recursive(NAME)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Define once control variable.  */
Packit 6c4009
#define __libc_once_define(CLASS, NAME) CLASS int NAME = 0
Packit 6c4009
Packit 6c4009
/* Call handler iff the first call.  */
Packit 6c4009
#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
Packit 6c4009
  do {									      \
Packit 6c4009
    if ((ONCE_CONTROL) == 0) {						      \
Packit 6c4009
      INIT_FUNCTION ();							      \
Packit 6c4009
      (ONCE_CONTROL) = 1;						      \
Packit 6c4009
    }									      \
Packit 6c4009
  } while (0)
Packit 6c4009
Packit 6c4009
/* Get once control variable.  */
Packit 6c4009
#define __libc_once_get(ONCE_CONTROL) \
Packit 6c4009
  ((ONCE_CONTROL) == 1)
Packit 6c4009
Packit 6c4009
/* Start a critical region with a cleanup function */
Packit 6c4009
#define __libc_cleanup_region_start(DOIT, FCT, ARG)			    \
Packit 6c4009
{									    \
Packit 6c4009
  typeof (***(FCT)) *__save_FCT = (DOIT) ? (FCT) : 0;			    \
Packit 6c4009
  typeof (ARG) __save_ARG = ARG;					    \
Packit 6c4009
  /* close brace is in __libc_cleanup_region_end below. */
Packit 6c4009
Packit 6c4009
/* End a critical region started with __libc_cleanup_region_start. */
Packit 6c4009
#define __libc_cleanup_region_end(DOIT)					    \
Packit 6c4009
  if ((DOIT) && __save_FCT != 0)					    \
Packit 6c4009
    (*__save_FCT)(__save_ARG);						    \
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
/* Sometimes we have to exit the block in the middle.  */
Packit 6c4009
#define __libc_cleanup_end(DOIT)					    \
Packit 6c4009
  if ((DOIT) && __save_FCT != 0)					    \
Packit 6c4009
    (*__save_FCT)(__save_ARG);						    \
Packit 6c4009
Packit 6c4009
#define __libc_cleanup_push(fct, arg) __libc_cleanup_region_start (1, fct, arg)
Packit 6c4009
#define __libc_cleanup_pop(execute) __libc_cleanup_region_end (execute)
Packit 6c4009
Packit 6c4009
/* We need portable names for some of the functions.  */
Packit 6c4009
#define __libc_mutex_unlock
Packit 6c4009
Packit 6c4009
/* Type for key of thread specific data.  */
Packit 6c4009
typedef int __libc_key_t;
Packit 6c4009
Packit 6c4009
/* Create key for thread specific data.  */
Packit 6c4009
#define __libc_key_create(KEY,DEST)	((void) (KEY), (void) (DEST), -1)
Packit 6c4009
Packit 6c4009
/* Set thread-specific data associated with KEY to VAL.  */
Packit 6c4009
#define __libc_setspecific(KEY,VAL)	((void) (KEY), (void) (VAL))
Packit 6c4009
Packit 6c4009
/* Get thread-specific data associated with KEY.  */
Packit 6c4009
#define __libc_getspecific(KEY)		((void) (KEY), (void *) 0)
Packit 6c4009
Packit 6c4009
#endif	/* libc-lock.h */