Changeset 7c844e3 in rtems


Ignore:
Timestamp:
May 17, 2002, 6:03:34 PM (18 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
c0af822e
Parents:
cb3a7ed
Message:

2001-05-17 Joel Sherrill <joel@…>

  • libc/envlock.c: Implemented code to let newlib's envlock share the libio open/close mutex. Since both should be lightly used, this should not lead to problems and saves resources.
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libcsupport/src/envlock.c

    rcb3a7ed r7c844e3  
    11/*
     2 *  Author: Till Straumann <strauman@slac.stanford.edu>, 3/2002
     3 *
    24 *  $Id$
    3  *
    4  *  Author: Till Straumann <strauman@slac.stanford.edu>, 3/2002
    55 */
    66
     
    3030 *  - NEWLIB-1.8.2 has an ugly BUG: if environ is NULL, _findenv_r() bails
    3131 *    out leaving the lock held :-(
     32 *
     33 *  Used by the following functions:
     34 *    findenv_r(), setenv_r(), and unsetenv_r() which are called by
     35 *    getenv(), getenv_r(), setenv(), and unsetenv().
    3236 * 
    3337 */
    3438
     39#if defined(ENVLOCK_DEDIDCATED_MUTEX)
    3540static rtems_id envLock=0;
    3641
     
    8186    rtems_semaphore_release(envLock);
    8287}
     88#else
     89
     90/*
     91 *  Reuse the libio mutex -- it is always initialized before we
     92 *  could possibly run.
     93 */
     94
     95#include <rtems/libio_.h>
     96
     97void
     98__env_lock(struct _reent *r)
     99{
     100  rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
     101}
     102
     103void
     104__env_unlock(struct _reent *r)
     105{
     106  rtems_semaphore_release( rtems_libio_semaphore );
     107}
     108#endif
  • c/src/lib/ChangeLog

    rcb3a7ed r7c844e3  
     12001-05-17      Joel Sherrill <joel@OARcorp.com>
     2
     3        * libc/envlock.c: Implemented code to let newlib's envlock share
     4        the libio open/close mutex.  Since both should be lightly used,
     5        this should not lead to problems and saves resources.
     6
    172002-05-15      Chris Johns <ccj@acm.org>
    28
  • c/src/lib/libc/envlock.c

    rcb3a7ed r7c844e3  
    11/*
     2 *  Author: Till Straumann <strauman@slac.stanford.edu>, 3/2002
     3 *
    24 *  $Id$
    3  *
    4  *  Author: Till Straumann <strauman@slac.stanford.edu>, 3/2002
    55 */
    66
     
    3030 *  - NEWLIB-1.8.2 has an ugly BUG: if environ is NULL, _findenv_r() bails
    3131 *    out leaving the lock held :-(
     32 *
     33 *  Used by the following functions:
     34 *    findenv_r(), setenv_r(), and unsetenv_r() which are called by
     35 *    getenv(), getenv_r(), setenv(), and unsetenv().
    3236 * 
    3337 */
    3438
     39#if defined(ENVLOCK_DEDIDCATED_MUTEX)
    3540static rtems_id envLock=0;
    3641
     
    8186    rtems_semaphore_release(envLock);
    8287}
     88#else
     89
     90/*
     91 *  Reuse the libio mutex -- it is always initialized before we
     92 *  could possibly run.
     93 */
     94
     95#include <rtems/libio_.h>
     96
     97void
     98__env_lock(struct _reent *r)
     99{
     100  rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
     101}
     102
     103void
     104__env_unlock(struct _reent *r)
     105{
     106  rtems_semaphore_release( rtems_libio_semaphore );
     107}
     108#endif
  • cpukit/libcsupport/src/envlock.c

    rcb3a7ed r7c844e3  
    11/*
     2 *  Author: Till Straumann <strauman@slac.stanford.edu>, 3/2002
     3 *
    24 *  $Id$
    3  *
    4  *  Author: Till Straumann <strauman@slac.stanford.edu>, 3/2002
    55 */
    66
     
    3030 *  - NEWLIB-1.8.2 has an ugly BUG: if environ is NULL, _findenv_r() bails
    3131 *    out leaving the lock held :-(
     32 *
     33 *  Used by the following functions:
     34 *    findenv_r(), setenv_r(), and unsetenv_r() which are called by
     35 *    getenv(), getenv_r(), setenv(), and unsetenv().
    3236 * 
    3337 */
    3438
     39#if defined(ENVLOCK_DEDIDCATED_MUTEX)
    3540static rtems_id envLock=0;
    3641
     
    8186    rtems_semaphore_release(envLock);
    8287}
     88#else
     89
     90/*
     91 *  Reuse the libio mutex -- it is always initialized before we
     92 *  could possibly run.
     93 */
     94
     95#include <rtems/libio_.h>
     96
     97void
     98__env_lock(struct _reent *r)
     99{
     100  rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
     101}
     102
     103void
     104__env_unlock(struct _reent *r)
     105{
     106  rtems_semaphore_release( rtems_libio_semaphore );
     107}
     108#endif
Note: See TracChangeset for help on using the changeset viewer.