aboutsummaryrefslogtreecommitdiff
path: root/libobjc/THREADS
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-09-08 09:35:50 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-09-08 09:35:50 +0000
commit88a2722e1fd941a7d02575a6663641d0739939a5 (patch)
tree2af7479e59d3f37ae5035d563a34809a2b4036c7 /libobjc/THREADS
parent0db1920c3d6841fafde80b28f86d90b8ab989212 (diff)
downloadgcc-88a2722e1fd941a7d02575a6663641d0739939a5.zip
gcc-88a2722e1fd941a7d02575a6663641d0739939a5.tar.gz
gcc-88a2722e1fd941a7d02575a6663641d0739939a5.tar.bz2
Removed obsolete intermediate threading layer.
* thr.c: Use __gthread_objc_xxx functions directly instead of __objc_thread_xxx ones. * objc/thr.h: Removed prototypes of no longer existing __objc_thread_xxx functions. * Makefile.in: Removed thr-objc.lo. * thr-dce.c: File removed. * thr-decosf1.c: File removed. * thr-irix.c: File removed. * thr-mach.c: File removed. * thr-objc.c: File removed. * thr-os2.c: File removed. * thr-posix.c: File removed. * thr-pthreads.c: File removed. * thr-rtems.c: File removed. * thr-single.c: File removed. * thr-solaris.c: File removed. * thr-vxworks.c: File removed. * thr-win32.c: File removed. * README.threads: File removed. * THREADS.MACH: File removed. * THREADS: Updated. From-SVN: r163996
Diffstat (limited to 'libobjc/THREADS')
-rw-r--r--libobjc/THREADS104
1 files changed, 33 insertions, 71 deletions
diff --git a/libobjc/THREADS b/libobjc/THREADS
index 8a43683..5004b2c 100644
--- a/libobjc/THREADS
+++ b/libobjc/THREADS
@@ -96,59 +96,21 @@ frontend/backend implementation.
The frontend, as characterized by the files thr.h and thr.c, is a set
of platform independent structures and functions which represent the
-user interface. Objective-C programs should use these structures and
-functions for their thread and mutex work if they wish to maintain a
-high degree of portability across platforms.
-
-The backend is composed of a file with the necessary code to map the ObjC
-thread and mutex to a platform specific implementation. For example, the
-file thr-solaris.c contains the implementation for Solaris.
-
-If you are compiling libobjc as part of GCC, the thr-objc.c backend is
-always used; this backend uses GCC's gthread code. The thread system
-is automatically configured when GCC is configured. Important: make
-sure you configure GCC using `--enable-threads' if you want threads !
-
-If you want to compile libobjc standalone, then you would need to
-modify the configure.in and makefiles for it; and you need to pick an
-appropriate backend file for the target platform; you make this choice
-by assigning the OBJC_THREAD_FILE make variable to the basename of the
-backend file. For example, OBJC_THREAD_FILE=thr-posix would indicate
-that the generic posix backend file, thr-posix.c, should be compiled
-with the ObjC runtime library. If your platform does not support
-threads then you should specify the OBJC_THREAD_FILE=thr-single
-backend file to compile the ObjC runtime library without thread or
-mutex support; note that programs which rely upon the ObjC thread and
-mutex functions will compile and link correctly but attempting to
-create a thread or mutex will result in an error.
-
-It is questionable whether it is really necessary to have both a
-frontend and backend function for all available functionality. On the
-one hand, it provides a clear, consistent differentiation between what
-is public and what is private with the downside of having the overhead
-of multiple functions calls. For example, the function to have a
-thread yield the processor is objc_thread_yield; in the current
-implementation this produces a function call set:
-
-objc_thread_yield() -> __objc_thread_yield() -> system yield function
-
-This has two extra function calls over calling the platform specific function
-explicitly, but the issue is whether only the overhead of a single function
-is necessary.
-
-objc_thread_yield() -> system yield function
-
-This breaks the public/private dichotomy between the frontend/backend
-for the sake of efficiency. It is possible to just use a preprocessor
-define so as to eliminate the extra function call:
-
-#define objc_thread_yield() __objc_thread_yield()
-
-This has the undesirable effect that if objc_thread_yield is actually
-turned into a function based upon future need; then ObjC programs which
-access the thread functions would need to be recompiled versus just
-being relinked.
-
+user interface. For example, objc_mutex_lock(). Objective-C programs
+should use these structures and functions for their thread and mutex
+work if they wish to maintain a high degree of portability across
+platforms.
+
+The backend is currently GCC's gthread code (gthr.h and related). For
+example, __gthread_objc_mutex_lock(). The thread system is
+automatically configured when GCC is configured. On most platforms
+this thread backend is able to automatically switch to non-multi-threaded
+mode if the threading library is not linked in.
+
+If you want to compile libobjc standalone, then you would need to modify
+the configure.in and makefiles for it and you need to import the
+gthread code from GCC.
+
******************************************************************************
* Threads:
@@ -212,34 +174,34 @@ objc_thread_get_data(void), void *
* Backend thread functions
* User programs should *NOT* directly call these functions.
-__objc_thread_detach(void (*func)(void *arg), void *arg), objc_thread_t
+__gthr_objc_thread_detach(void (*func)(void *arg), void *arg), objc_thread_t
Spawns a new thread executing func, called by objc_thread_detach.
Return NULL if error otherwise return thread id.
-__objc_thread_set_priority(int priority), int
+__gthr_objc_thread_set_priority(int priority), int
Set the thread's priority, called by objc_thread_set_priority.
Return -1 if error otherwise return 0.
-__objc_thread_get_priority(void), int
+__gthr_objc_thread_get_priority(void), int
Query a thread's priority, called by objc_thread_get_priority.
Return -1 if error otherwise return the priority.
-__objc_thread_yield(void), void
+__gthr_objc_thread_yield(void), void
Yields the processor, called by objc_thread_yield.
-__objc_thread_exit(void), int
+__gthr_objc_thread_exit(void), int
Terminates the thread, called by objc_thread_exit.
Return -1 if error otherwise function does not return.
-__objc_thread_id(void), objc_thread_t
+__gthr_objc_thread_id(void), objc_thread_t
Returns the current thread's id, called by objc_thread_id.
Return -1 if error otherwise return thread id.
-__objc_thread_set_data(void *value), int
+__gthr_objc_thread_set_data(void *value), int
Set pointer for thread local storage, called by objc_thread_set_data.
Returns -1 if error otherwise return 0.
-__objc_thread_get_data(void), void *
+__gthr_objc_thread_get_data(void), void *
Returns the pointer to the thread's local storage.
Returns NULL if error, called by objc_thread_get_data.
@@ -284,23 +246,23 @@ objc_mutex_unlock(objc_mutex_t mutex), int
* Backend mutex functions
* User programs should *NOT* directly call these functions.
-__objc_mutex_allocate(objc_mutex_t mutex), int
+__gthr_objc_mutex_allocate(objc_mutex_t mutex), int
Allocates a new mutex, called by objc_mutex_allocate.
Return -1 if error otherwise return 0.
-__objc_mutex_deallocate(objc_mutex_t mutex), int
+__gthr_objc_mutex_deallocate(objc_mutex_t mutex), int
Free a mutex, called by objc_mutex_deallocate.
Return -1 if error otherwise return 0.
-__objc_mutex_lock(objc_mutex_t mutex), int
+__gthr_objc_mutex_lock(objc_mutex_t mutex), int
Locks a mutex, called by objc_mutex_lock.
Return -1 if error otherwise return 0.
-__objc_mutex_trylock(objc_mutex_t mutex), int
+__gthr_objc_mutex_trylock(objc_mutex_t mutex), int
Attempts to lock a mutex, called by objc_mutex_trylock.
Return -1 if failed to acquire lock or error otherwise return 0.
-__objc_mutex_unlock(objc_mutex_t mutex), int
+__gthr_objc_mutex_unlock(objc_mutex_t mutex), int
Unlocks the mutex, called by objc_mutex_unlock.
Return -1 if error otherwise return 0.
@@ -354,24 +316,24 @@ objc_condition_signal(objc_condition_t condition), int
* User programs should *NOT* directly call these functions.
*
-__objc_condition_allocate(objc_condition_t condition), int
+__gthr_objc_condition_allocate(objc_condition_t condition), int
Allocate a condition mutex, called by objc_condition_allocate.
Return -1 if error otherwise return 0.
-__objc_condition_deallocate(objc_condition_t condition), int
+__gthr_objc_condition_deallocate(objc_condition_t condition), int
Deallocate a condition, called by objc_condition_deallocate.
Return -1 if error otherwise return 0.
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int
+__gthr_objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int
Wait on the condition, called by objc_condition_wait.
Return -1 if error otherwise return 0 when condition is met.
-__objc_condition_broadcast(objc_condition_t condition), int
+__gthr_objc_condition_broadcast(objc_condition_t condition), int
Wake up all threads waiting on this condition.
Called by objc_condition_broadcast.
Return -1 if error otherwise return 0.
-__objc_condition_signal(objc_condition_t condition), int
+__gthr_objc_condition_signal(objc_condition_t condition), int
Wake up one thread waiting on this condition.
Called by objc_condition_signal.
Return -1 if error otherwise return 0.