From 1fbe4bd0a5acf70a2a4ace349c7741b3c075a13a Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Fri, 25 Mar 2005 08:50:10 +0000 Subject: [PATCH] - Added a description of the thread-safe stdin/stdout/stderr behaviour. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14900 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- documentation/README.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/documentation/README.html b/documentation/README.html index 2194982..32c99da 100644 --- a/documentation/README.html +++ b/documentation/README.html @@ -57,11 +57,13 @@ when it starts up. This is controlled via the __stack_size variable (se

I added some amiga.lib and debug.lib functionality to the library, but don't count on it to be complete.

+

2.1 Thread-safety

+

The library code is supposed to be thread-safe if built with the __THREAD_SAFE preprocesssor symbold defined. Note that 'thread-safe' does not mean 'reentrant'. Multiple callers for certain library functions are permitted, but not for all of them. For example, mkdtemp() is not thread-safe, and neither is -rand() or localtime(). But as per POSIX 1003.1c-1995 there are thread-safe +rand() or localtime(). But as per POSIX 1003.1c-1995 there are thread-safe variants of rand() and localtime() called rand_r(), localtime_r(), and others. The use of the socket I/O functions is still problematic because the underlying bsdsocket.library API is not supposed to be used by any process @@ -71,10 +73,19 @@ error code left by the last caller.

Take care: thread-safety does not imply that you can have multiple callers access and close the same file. There is no resource tracking to that degree -yet. All the thread-safety tries to afford you is not to get into big trouble +yet. All that the thread-safety tries to afford you is not to get into big trouble if simultaneous and overlapping accesses to files, memory allocation and other resources are taking place.

+

Also take care with file I/O involving the stdin/stdout/stderr +streams; read/write operations on these streams will be mapped to the Input()/Output()/ErrorOutput() +file handles of the process performing these operations. Since only this small set of +operations is mapped, functions such as fcntl() or select() will not +work on the stdin/stdout/stderr streams and the corresponding +file descriptors STDIN_FILENO/STDOUT_FILENO/STDERR_FILENO. +It is therefore strongly recommended to use the thread-safe library only for applications +which can cope with the limitations described above.

+

3. What does it not do?