mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Added a hopefully enlightening comment on the subtleties of semaphore
locking in the stdio_fflush.c file. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14915 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: complex.h,v 1.1 2005-04-03 10:22:48 obarthel Exp $
|
||||
* $Id: complex.h,v 1.2 2005-04-04 11:56:26 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -65,7 +65,7 @@ extern "C" {
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Basic types. */
|
||||
/* Basic types; imaginary is assumed not to be implemented yet. */
|
||||
#define complex _Complex
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_fflush.c,v 1.6 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: stdio_fflush.c,v 1.7 2005-04-04 11:56:22 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -55,6 +55,17 @@ fflush(FILE *stream)
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
/* Subtlety alert: the thread-safe library needs to obtain locks for
|
||||
stdio, buffered files and file descriptors in a very particular
|
||||
order in order to steer clear of deadlocks. The order is as given
|
||||
above: stdio, buffered files, file descriptor table entries. Which
|
||||
normally means that if code has any business locking stdio or the
|
||||
file descriptor table entries, it should lock stdio first. This
|
||||
function, at least in the UNIX_PATH_SEMANTICS variant, does not do
|
||||
this. Here's why: if the 'stream' variable is NULL to start with,
|
||||
no per-stream locking is performed anyway, and the stdio lock can
|
||||
be obtained without running the risk of having obtain semaphores
|
||||
in the wrong order. */
|
||||
flockfile(stream);
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_main.c,v 1.22 2005-04-01 18:46:37 obarthel Exp $
|
||||
* $Id: stdlib_main.c,v 1.23 2005-04-04 11:56:22 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -354,7 +354,7 @@ _main(void)
|
||||
__stack_size = size;
|
||||
}
|
||||
|
||||
/* How much stack size was provided? */
|
||||
/* How much stack space was provided? */
|
||||
current_stack_size = get_stack_size();
|
||||
|
||||
/* If this is a resident program, don't allow for the detach
|
||||
|
||||
Reference in New Issue
Block a user