Back to index

glibc  2.9
Classes | Defines
stdio-lock.h File Reference
#include <bits/libc-lock.h>
#include <lowlevellock.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _IO_lock_t

Defines

#define _IO_lock_inexpensive   1
#define _IO_lock_initializer   { LLL_LOCK_INITIALIZER, 0, NULL }
#define _IO_lock_init(_name)   ((_name) = (_IO_lock_t) _IO_lock_initializer , 0)
#define _IO_lock_fini(_name)   ((void) 0)
#define _IO_lock_lock(_name)
#define _IO_lock_trylock(_name)
#define _IO_lock_unlock(_name)
#define _IO_cleanup_region_start(_fct, _fp)   __libc_cleanup_region_start (((_fp)->_flags & _IO_USER_LOCK) == 0, _fct, _fp)
#define _IO_cleanup_region_start_noarg(_fct)   __libc_cleanup_region_start (1, _fct, NULL)
#define _IO_cleanup_region_end(_doit)   __libc_cleanup_region_end (_doit)

Class Documentation

struct _IO_lock_t

Definition at line 30 of file stdio-lock.h.

Class Members
int cnt
int lock
void * owner

Define Documentation

#define _IO_cleanup_region_end (   _doit)    __libc_cleanup_region_end (_doit)

Definition at line 85 of file stdio-lock.h.

#define _IO_cleanup_region_start (   _fct,
  _fp 
)    __libc_cleanup_region_start (((_fp)->_flags & _IO_USER_LOCK) == 0, _fct, _fp)

Definition at line 81 of file stdio-lock.h.

Definition at line 83 of file stdio-lock.h.

#define _IO_lock_fini (   _name)    ((void) 0)

Definition at line 37 of file stdio-lock.h.

#define _IO_lock_inexpensive   1

Definition at line 28 of file stdio-lock.h.

#define _IO_lock_init (   _name)    ((_name) = (_IO_lock_t) _IO_lock_initializer , 0)

Definition at line 34 of file stdio-lock.h.

Definition at line 32 of file stdio-lock.h.

#define _IO_lock_lock (   _name)
Value:
do {                                                                 \
    void *__self = THREAD_SELF;                                             \
    if ((_name).owner != __self)                                     \
      {                                                                     \
       lll_lock ((_name).lock, LLL_PRIVATE);                                \
        (_name).owner = __self;                                             \
      }                                                                     \
    ++(_name).cnt;                                                   \
  } while (0)

Definition at line 40 of file stdio-lock.h.

#define _IO_lock_trylock (   _name)
Value:
({                                                                   \
    int __result = 0;                                                       \
    void *__self = THREAD_SELF;                                             \
    if ((_name).owner != __self)                                     \
      {                                                                     \
        if (lll_trylock ((_name).lock) == 0)                                \
          {                                                          \
            (_name).owner = __self;                                         \
            (_name).cnt = 1;                                                \
          }                                                          \
        else                                                         \
          __result = EBUSY;                                          \
      }                                                                     \
    else                                                             \
      ++(_name).cnt;                                                 \
    __result;                                                        \
  })

Definition at line 51 of file stdio-lock.h.

#define _IO_lock_unlock (   _name)
Value:
do {                                                                 \
    if (--(_name).cnt == 0)                                          \
      {                                                                     \
        (_name).owner = NULL;                                               \
       lll_unlock ((_name).lock, LLL_PRIVATE);                              \
      }                                                                     \
  } while (0)

Definition at line 70 of file stdio-lock.h.