OSDN Git Service

Removed obsolete intermediate threading layer.
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Sep 2010 09:35:50 +0000 (09:35 +0000)
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Sep 2010 09:35:50 +0000 (09:35 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163996 138bc75d-0d04-0410-961f-82ee72b054a4

20 files changed:
libobjc/ChangeLog
libobjc/Makefile.in
libobjc/README.threads [deleted file]
libobjc/THREADS
libobjc/THREADS.MACH [deleted file]
libobjc/objc/thr.h
libobjc/thr-dce.c [deleted file]
libobjc/thr-decosf1.c [deleted file]
libobjc/thr-irix.c [deleted file]
libobjc/thr-mach.c [deleted file]
libobjc/thr-objc.c [deleted file]
libobjc/thr-os2.c [deleted file]
libobjc/thr-posix.c [deleted file]
libobjc/thr-pthreads.c [deleted file]
libobjc/thr-rtems.c [deleted file]
libobjc/thr-single.c [deleted file]
libobjc/thr-solaris.c [deleted file]
libobjc/thr-vxworks.c [deleted file]
libobjc/thr-win32.c [deleted file]
libobjc/thr.c

index e70f7f9..69af813 100644 (file)
@@ -1,3 +1,28 @@
+2010-09-08  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       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.
+
 2010-09-07  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * Object.m (MAX_CLASS_NAME_LEN): Unused define removed.
index 71faf8a..891c660 100644 (file)
@@ -93,7 +93,6 @@ LIBTOOL_CLEAN   = $(LIBTOOL) --mode=clean
 #LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
 
 OBJC_GCFLAGS=-DOBJC_WITH_GC=1
-OBJC_THREAD_FILE=thr-objc
 OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
 OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@
 OBJC_BOEHM_GC_LIBS=../boehm-gc/libgcjgc_convenience.la $(thread_libs_and_flags)
@@ -153,13 +152,13 @@ OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \
 OBJS =    archive.lo class.lo encoding.lo gc.lo hash.lo init.lo linking.lo \
          misc.lo nil_method.lo NXConstStr.lo Object.lo objects.lo \
          Protocol.lo sarray.lo selector.lo sendmsg.lo thr.lo \
-         $(OBJC_THREAD_FILE).lo exception.lo
+          exception.lo
 
 OBJS_GC = archive_gc.lo class_gc.lo encoding_gc.lo gc_gc.lo hash_gc.lo \
          init_gc.lo linking_gc.lo misc_gc.lo nil_method_gc.lo \
          NXConstStr_gc.lo Object_gc.lo objects_gc.lo Protocol_gc.lo \
          sarray_gc.lo selector_gc.lo sendmsg_gc.lo thr_gc.lo \
-         $(OBJC_THREAD_FILE)_gc.lo exception_gc.lo
+         exception_gc.lo
 
 runtime-info.h: 
        echo "" > tmp-runtime.m
@@ -257,10 +256,6 @@ thr_gc.lo: thr.c
        $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
                $(INCLUDES) $<
 
-$(OBJC_THREAD_FILE)_gc.lo: $(OBJC_THREAD_FILE).c
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
-
 exception.lo: exception.c
        $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) \
                -fexceptions $(INCLUDES) $<
diff --git a/libobjc/README.threads b/libobjc/README.threads
deleted file mode 100644 (file)
index 5f15bd9..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-==============================================================================
-README.threads - Wed Nov 29 15:16:24 EST 1995
-------------------------------------------------------------------------------
-
-Limited documentation is available in the THREADS file.
-
-This version has been tested on Sun Solaris, SGI Irix, and Windows NT.
-It should also work on any single threaded system.
-
-Thanks go to the following people for help test and debug the library:
-
-       Scott Christley, scottc@ocbi.com
-       Andrew McCallum, mccallum@cs.rochester.edu
-
-galen
-gchunt@cs.rochester.edu
-
-Any questions, bug reports, etc should be directed to:
-
-Scott Christley, scottc@ocbi.com
-
-Please do not bug Galen with email as he no longer supports the code.
-
-==============================================================================
-Changes from prior releases (in revered chronological order):
-------------------------------------------------------------------------------
-
-* Fixed bug in copy part of sarray_realloc.  I had an < which should
-  have been <=. (Bug report from Scott).
-
-------------------------------------------------------------------------------
-
-* Support for DEC OSF/1 is definitely broken.  My programs always
-  seg-fault when I link with libpthreads.a.
-
-* Thread id's are no longer int's, but are instead of type
-  _objc_thread_t which is typedef'ed from a void *.  An invalid thread
-  id is denoted by NULL and not -1 as before.
-
-------------------------------------------------------------------------------
-
-* Renamed thread-winnt.c to thread-win32.c to better reflect support
-  for the API on both Windows NT and Windows 95 platforms.  
-  (Who knows, maybe even Win32s :-).
-
-* Fixed bugs in Win32 support as per report from Scott Christley.
-
-* Fixed bug in sarray_get as per report from Scott Christley.
-
-       
index 8a43683..5004b2c 100644 (file)
@@ -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.
diff --git a/libobjc/THREADS.MACH b/libobjc/THREADS.MACH
deleted file mode 100644 (file)
index 55de663..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-This readme refers to the file thr-mach.c.
-
-Under mach, thread priorities are kinda strange-- any given thread has
-a MAXIMUM priority and a BASE priority.  The BASE priority is the
-current priority of the thread and the MAXIMUM is the maximum possible
-priority the thread can assume.  The developer can lower, but never
-raise the maximum priority.
-
-The gcc concept of thread priorities is that they run at one of three
-levels;  interactive, background, and low.
-
-Under mach, this is translated to:
-
-interactive -- set priority to maximum
-background  -- set priority to 2/3 of maximum
-low         -- set priority to 1/3 of maximum
-
-This means that it is possible for a thread with the priority of
-interactive to actually run at a lower priority than another thread
-with a background, or even low, priority if the developer has modified
-the maximum priority.
-
-
index 997fb3a..488ca94 100644 (file)
@@ -108,31 +108,6 @@ objc_thread_callback objc_set_thread_callback (objc_thread_callback func);
 
 /* Backend initialization functions */
 int __objc_init_thread_system (void);
-int __objc_fini_thread_system (void);
-
-/* Backend mutex functions */
-int __objc_mutex_allocate (objc_mutex_t mutex);
-int __objc_mutex_deallocate (objc_mutex_t mutex);
-int __objc_mutex_lock (objc_mutex_t mutex);
-int __objc_mutex_trylock (objc_mutex_t mutex);
-int __objc_mutex_unlock (objc_mutex_t mutex);
-
-/* Backend condition mutex functions */
-int __objc_condition_allocate (objc_condition_t condition);
-int __objc_condition_deallocate (objc_condition_t condition);
-int __objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex);
-int __objc_condition_broadcast (objc_condition_t condition);
-int __objc_condition_signal (objc_condition_t condition);
-
-/* Backend thread functions */
-objc_thread_t __objc_thread_detach (void (*func) (void *arg), void *arg);
-int __objc_thread_set_priority (int priority);
-int __objc_thread_get_priority (void);
-void __objc_thread_yield (void);
-int __objc_thread_exit (void);
-objc_thread_t __objc_thread_id (void);
-int __objc_thread_set_data (void *value);
-void * __objc_thread_get_data (void);
 
 #ifdef __cplusplus
 }
diff --git a/libobjc/thr-dce.c b/libobjc/thr-dce.c
deleted file mode 100644 (file)
index ad31c8b..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-/* GNU Objective C Runtime Thread Interface
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
-   Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include <pthread.h>
-#include "objc/thr.h"
-#include "objc/runtime.h"
-
-/* Key structure for maintaining thread specific storage */
-static pthread_key_t _objc_thread_storage;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  /* Initialize the thread storage key */
-  return pthread_keycreate(&_objc_thread_storage, NULL);
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  /* Destroy the thread storage key */
-  /* Not implemented yet */
-  /* return pthread_key_delete(&_objc_thread_storage); */
-  return 0;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
-{
-  objc_thread_t thread_id;
-  pthread_t new_thread_handle;
-
-  if (pthread_create(&new_thread_handle, pthread_attr_default,
-                    (void *)func, arg) == 0)
-    {
-      /* ??? May not work! (64bit) */
-      thread_id = *(objc_thread_t *)&new_thread_handle; 
-      pthread_detach(&new_thread_handle);     /* Fully detach thread.     */
-    }
-  else
-    thread_id = NULL;
-  
-  return thread_id;
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority(int priority)
-{
-  int sys_priority = 0;
-
-  switch (priority)
-    {
-    case OBJC_THREAD_INTERACTIVE_PRIORITY:
-      sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2;
-      break;
-    default:
-    case OBJC_THREAD_BACKGROUND_PRIORITY:
-      sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2;
-      break;
-    case OBJC_THREAD_LOW_PRIORITY:
-      sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2;
-      break;
-    }
-    
-  /* Change the priority. */
-  if (pthread_setprio(pthread_self(), sys_priority) >= 0)
-    return 0;
-  else
-    /* Failed */
-    return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  int sys_priority;
-    
-  if ((sys_priority = pthread_getprio(pthread_self())) >= 0) {
-    if (sys_priority >= PRI_FG_MIN_NP && sys_priority <= PRI_FG_MAX_NP)
-      return OBJC_THREAD_INTERACTIVE_PRIORITY;
-    if (sys_priority >= PRI_BG_MIN_NP && sys_priority <= PRI_BG_MAX_NP)
-      return OBJC_THREAD_BACKGROUND_PRIORITY;
-    return OBJC_THREAD_LOW_PRIORITY;
-  }
-
-  /* Failed */
-  return -1;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  pthread_yield();
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  /* exit the thread */
-  pthread_exit(&__objc_thread_exit_status);
-
-  /* Failed if we reached here */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  pthread_t self = pthread_self();
-
-  return (objc_thread_t) pthread_getunique_np (&self);
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  return pthread_setspecific(_objc_thread_storage, value);
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  void *value = NULL;
-
-  if ( !(pthread_getspecific(_objc_thread_storage, &value)) )
-    return value;
-
-  return NULL;
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), 
-                        pthread_mutexattr_default))
-    return -1;
-  else
-    return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend))))
-    return -1;
-  else
-    return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend)));
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  if (pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))) != 1)
-    return -1;
-  else
-    return 0;
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend)));
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-
-  /*
-  if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL))
-    return -1;
-  else
-    return 0;
-    */
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-
-  /*
-  return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend)));
-  */
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  /* Unimplemented. */
-  return -1;
-
-  /*
-  return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)),
-                          (pthread_mutex_t *)(&(mutex->backend)));
-                          */
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-
-  /*
-  return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend)));
-  */
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-
-  /*
-  return pthread_cond_signal((pthread_cond_t *)(&(condition->backend)));
-  */
-}
-
-/* End of File */
diff --git a/libobjc/thr-decosf1.c b/libobjc/thr-decosf1.c
deleted file mode 100644 (file)
index ad31c8b..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-/* GNU Objective C Runtime Thread Interface
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
-   Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include <pthread.h>
-#include "objc/thr.h"
-#include "objc/runtime.h"
-
-/* Key structure for maintaining thread specific storage */
-static pthread_key_t _objc_thread_storage;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  /* Initialize the thread storage key */
-  return pthread_keycreate(&_objc_thread_storage, NULL);
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  /* Destroy the thread storage key */
-  /* Not implemented yet */
-  /* return pthread_key_delete(&_objc_thread_storage); */
-  return 0;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
-{
-  objc_thread_t thread_id;
-  pthread_t new_thread_handle;
-
-  if (pthread_create(&new_thread_handle, pthread_attr_default,
-                    (void *)func, arg) == 0)
-    {
-      /* ??? May not work! (64bit) */
-      thread_id = *(objc_thread_t *)&new_thread_handle; 
-      pthread_detach(&new_thread_handle);     /* Fully detach thread.     */
-    }
-  else
-    thread_id = NULL;
-  
-  return thread_id;
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority(int priority)
-{
-  int sys_priority = 0;
-
-  switch (priority)
-    {
-    case OBJC_THREAD_INTERACTIVE_PRIORITY:
-      sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2;
-      break;
-    default:
-    case OBJC_THREAD_BACKGROUND_PRIORITY:
-      sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2;
-      break;
-    case OBJC_THREAD_LOW_PRIORITY:
-      sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2;
-      break;
-    }
-    
-  /* Change the priority. */
-  if (pthread_setprio(pthread_self(), sys_priority) >= 0)
-    return 0;
-  else
-    /* Failed */
-    return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  int sys_priority;
-    
-  if ((sys_priority = pthread_getprio(pthread_self())) >= 0) {
-    if (sys_priority >= PRI_FG_MIN_NP && sys_priority <= PRI_FG_MAX_NP)
-      return OBJC_THREAD_INTERACTIVE_PRIORITY;
-    if (sys_priority >= PRI_BG_MIN_NP && sys_priority <= PRI_BG_MAX_NP)
-      return OBJC_THREAD_BACKGROUND_PRIORITY;
-    return OBJC_THREAD_LOW_PRIORITY;
-  }
-
-  /* Failed */
-  return -1;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  pthread_yield();
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  /* exit the thread */
-  pthread_exit(&__objc_thread_exit_status);
-
-  /* Failed if we reached here */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  pthread_t self = pthread_self();
-
-  return (objc_thread_t) pthread_getunique_np (&self);
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  return pthread_setspecific(_objc_thread_storage, value);
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  void *value = NULL;
-
-  if ( !(pthread_getspecific(_objc_thread_storage, &value)) )
-    return value;
-
-  return NULL;
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), 
-                        pthread_mutexattr_default))
-    return -1;
-  else
-    return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend))))
-    return -1;
-  else
-    return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend)));
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  if (pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))) != 1)
-    return -1;
-  else
-    return 0;
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend)));
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-
-  /*
-  if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL))
-    return -1;
-  else
-    return 0;
-    */
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-
-  /*
-  return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend)));
-  */
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  /* Unimplemented. */
-  return -1;
-
-  /*
-  return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)),
-                          (pthread_mutex_t *)(&(mutex->backend)));
-                          */
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-
-  /*
-  return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend)));
-  */
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-
-  /*
-  return pthread_cond_signal((pthread_cond_t *)(&(condition->backend)));
-  */
-}
-
-/* End of File */
diff --git a/libobjc/thr-irix.c b/libobjc/thr-irix.c
deleted file mode 100644 (file)
index 84a5fc1..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-/* GNU Objective C Runtime Thread Interface - SGI IRIX Implementation
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
-   Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/sysmp.h>
-#include <sys/prctl.h>
-#include <ulocks.h>
-#include "objc/thr.h"
-#include "objc/runtime.h"
-
-/* Key structure for maintaining thread specific storage */
-static void * __objc_shared_arena_handle = NULL;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  /* Name of IRIX arena. */
-  char arena_name[64];
-
-  DEBUG_PRINTF("__objc_init_thread_system\n");
-
-  /* Construct a temporary name for arena. */
-  sprintf(arena_name, "/usr/tmp/objc_%05u", (unsigned)getpid());
-
-  /* Up to 256 threads.  Arena only for threads. */
-  usconfig(CONF_INITUSERS, 256);
-  usconfig(CONF_ARENATYPE, US_SHAREDONLY);
-
-  /* Initialize the arena */
-  if (!(__objc_shared_arena_handle = usinit(arena_name)))
-    /* Failed */
-    return -1;
-
-  return 0;
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  return 0;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
-{
-  objc_thread_t thread_id;
-  int sys_id;
-
-  if ((sys_id = sproc((void *)func, PR_SALL, arg)) >= 0)
-    thread_id = (objc_thread_t)sys_id;
-  else
-    thread_id = NULL;
-  
-  return thread_id;
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority(int priority)
-{
-  /* Not implemented yet */
-  return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  /* Not implemented yet */
-  return OBJC_THREAD_INTERACTIVE_PRIORITY;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  sginap(0);
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  /* IRIX only has exit. */
-  exit(__objc_thread_exit_status);
-
-  /* Failed if we reached here */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  /* Threads are processes. */
-  return (objc_thread_t)get_pid();
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  *((void **)&PRDA->usr_prda) = value;
-  return 0;
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  return *((void **)&PRDA->usr_prda);
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  if (!( (ulock_t)(mutex->backend) = usnewlock(__objc_shared_arena_handle) ))
-    return -1;
-  else
-    return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  usfreelock((ulock_t)(mutex->backend), __objc_shared_arena_handle);
-  return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  if (ussetlock((ulock_t)(mutex->backend)) == 0)
-    return -1;
-  else
-    return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  if (ustestlock((ulock_t)(mutex->backend)) == 0)
-    return -1;
-  else
-    return 0;
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  usunsetlock((ulock_t)(mutex->backend));
-  return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* End of File */
diff --git a/libobjc/thr-mach.c b/libobjc/thr-mach.c
deleted file mode 100644 (file)
index 19b95db..0000000
+++ /dev/null
@@ -1,312 +0,0 @@
-/* GNU Objective C Runtime Thread Implementation
-   Copyright (C) 1996, 1997, 2002, 2009 Free Software Foundation, Inc.
-   Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-   Modified for Mach threads by Bill Bumgarner <bbum@friday.com>
-   Condition functions added by Mircea Oancea <mircea@first.elcom.pub.ro>
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include <mach/mach.h>
-#include <mach/cthreads.h>
-#include "objc/thr.h"
-#include "objc/runtime.h"
-
-/*
-  Obtain the maximum thread priority that can set for t.  Under the
-  mach threading model, it is possible for the developer to adjust the
-  maximum priority downward only-- cannot be raised without superuser
-  privileges.  Once lowered, it cannot be raised.
-  */
-static int
-__mach_get_max_thread_priority (cthread_t t, int *base)
-{
-  thread_t threadP;
-  kern_return_t error;
-  struct thread_sched_info info;
-  unsigned int info_count=THREAD_SCHED_INFO_COUNT;
-    
-  if (t == NULL)
-    return -1;
-
-  threadP  = cthread_thread (t);       /* get thread underlying */
-
-  error = thread_info (threadP, THREAD_SCHED_INFO, 
-                      (thread_info_t) &info, &info_count);
-
-  if (error != KERN_SUCCESS)
-    return -1;
-
-  if (base != NULL)
-    *base = info.base_priority;
-
-  return info.max_priority;
-}
-       
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system (void)
-{
-  return 0;
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system (void)
-{
-  return 0;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach (void (*func) (void *arg), void *arg)
-{
-  objc_thread_t thread_id;
-  cthread_t new_thread_handle;
-
-  /* create thread */
-  new_thread_handle = cthread_fork ((cthread_fn_t) func, arg);
-
-  if (new_thread_handle)
-    {
-      /* this is not terribly portable */
-      thread_id = *(objc_thread_t *) &new_thread_handle; 
-      cthread_detach (new_thread_handle);
-    }
-  else
-    thread_id = NULL;
-  
-  return thread_id;
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority (int priority)
-{
-  objc_thread_t *t = objc_thread_id ();
-  cthread_t cT = (cthread_t) t; 
-  int maxPriority = __mach_get_max_thread_priority (cT, NULL);
-  int sys_priority = 0;
-
-  if (maxPriority == -1)
-    return -1;
-
-  switch (priority)
-    {
-    case OBJC_THREAD_INTERACTIVE_PRIORITY:
-      sys_priority = maxPriority;
-      break;
-    case OBJC_THREAD_BACKGROUND_PRIORITY:
-      sys_priority = (maxPriority * 2) / 3;
-      break;
-    case OBJC_THREAD_LOW_PRIORITY:
-      sys_priority = maxPriority / 3;
-      break;
-    default:
-      return -1;
-    }
-
-  if (sys_priority == 0)
-    return -1;
-
-  /* Change the priority */
-  if (cthread_priority (cT, sys_priority, 0) == KERN_SUCCESS)
-    return 0;
-  else
-    return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority (void)
-{
-  objc_thread_t *t = objc_thread_id ();
-  cthread_t cT = (cthread_t) t; /* see objc_thread_id () */
-  int basePriority;
-  int maxPriority;
-  int sys_priority = 0;
-
-  int interactiveT, backgroundT, lowT; /* thresholds */
-
-  maxPriority = __mach_get_max_thread_priority (cT, &basePriority);
-
-  if (maxPriority == -1)
-    return -1;
-
-  if (basePriority > ( (maxPriority * 2) / 3))
-    return OBJC_THREAD_INTERACTIVE_PRIORITY;
-
-  if (basePriority > ( maxPriority / 3))
-    return OBJC_THREAD_BACKGROUND_PRIORITY;
-
-  return OBJC_THREAD_LOW_PRIORITY;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield (void)
-{
-  cthread_yield ();
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit (void)
-{
-  /* exit the thread */
-  cthread_exit (&__objc_thread_exit_status);
-
-  /* Failed if we reached here */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id (void)
-{
-  cthread_t self = cthread_self ();
-
-  return *(objc_thread_t *) &self;
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data (void *value)
-{
-  cthread_set_data (cthread_self (), (any_t) value);
-  return 0;
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data (void)
-{
-  return (void *) cthread_data (cthread_self ());
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate (objc_mutex_t mutex)
-{
-  int err = 0;
-  mutex->backend = objc_malloc (sizeof (struct mutex));
-
-  err = mutex_init ((mutex_t) (mutex->backend));
-
-  if (err != 0)
-    {
-      objc_free (mutex->backend);
-      return -1;
-    }
-  else
-    return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate (objc_mutex_t mutex)
-{
-  mutex_clear ((mutex_t) (mutex->backend));
-
-  objc_free (mutex->backend);
-  mutex->backend = NULL;
-  return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock (objc_mutex_t mutex)
-{
-  mutex_lock ((mutex_t) (mutex->backend));
-  return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock (objc_mutex_t mutex)
-{
-  if (mutex_try_lock ((mutex_t) (mutex->backend)) == 0)
-    return -1;
-  else
-    return 0;
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock (objc_mutex_t mutex)
-{
-  mutex_unlock ((mutex_t) (mutex->backend));
-  return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate (objc_condition_t condition)
-{
-  condition->backend = objc_malloc (sizeof (struct condition));
-  condition_init ((condition_t) (condition->backend));
-  return 0;
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate (objc_condition_t condition)
-{
-  condition_clear ((condition_t) (condition->backend));
-  objc_free (condition->backend);
-  condition->backend = NULL;
-  return 0;
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
-{
-  condition_wait ((condition_t) (condition->backend),
-                 (mutex_t) (mutex->backend));
-  return 0;
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast (objc_condition_t condition)
-{
-  condition_broadcast ((condition_t) (condition->backend));
-  return 0;
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal (objc_condition_t condition)
-{
-  condition_signal ((condition_t) (condition->backend));
-  return 0;
-}
-
-/* End of File */
diff --git a/libobjc/thr-objc.c b/libobjc/thr-objc.c
deleted file mode 100644 (file)
index 5cc6433..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/* GNU Objective C Runtime Thread Interface.
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2009
-   Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#define _LIBOBJC
-/* The line below is needed for declarations of functions such as
-   pthread_mutexattr_settype, without which gthr-posix.h may fail to
-   compile within libobjc.  Unfortunately, this breaks compilation on
-   Tru64 UNIX V4.0F, so disable it there.  */
-#ifndef __osf__
-#define _XOPEN_SOURCE 500
-#endif
-#include "config.h"
-#include "tconfig.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "defaults.h"
-#include "objc/thr.h"
-#include "objc/runtime.h"
-#include <gthr.h>
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  return __gthread_objc_init_thread_system ();
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  return __gthread_objc_close_thread_system ();
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *), void *arg)
-{
-  return __gthread_objc_thread_detach (func, arg);
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority(int priority)
-{
-  return __gthread_objc_thread_set_priority (priority);
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  return __gthread_objc_thread_get_priority ();
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  __gthread_objc_thread_yield ();
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  return __gthread_objc_thread_exit ();
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  return __gthread_objc_thread_id ();
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  return __gthread_objc_thread_set_data (value);
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  return __gthread_objc_thread_get_data ();
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  return __gthread_objc_mutex_allocate (mutex);
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  return __gthread_objc_mutex_deallocate (mutex);
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  return __gthread_objc_mutex_lock (mutex);
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  return __gthread_objc_mutex_trylock (mutex);
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  return __gthread_objc_mutex_unlock (mutex);
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  return __gthread_objc_condition_allocate (condition);
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  return __gthread_objc_condition_deallocate (condition);
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  return __gthread_objc_condition_wait (condition, mutex);
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  return __gthread_objc_condition_broadcast (condition);
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  return __gthread_objc_condition_signal (condition);
-}
-
-/* End of File */
diff --git a/libobjc/thr-os2.c b/libobjc/thr-os2.c
deleted file mode 100644 (file)
index 1f9e3ae..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/* GNU Objective C Runtime Thread Interface - OS/2 emx Implementation
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
-   Contributed by Thomas Baier (baier@ci.tuwien.ac.at)
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include "objc/thr.h"
-#include "objc/runtime.h"
-
-#define INCL_DOSSEMAPHORES
-#define INCL_DOSPROCESS
-
-/*
- * conflicts with objc.h:       SEL, BOOL, id
- * solution:  prefixing those with _OS2_ before including <os2.h>
- */
-#define SEL _OS2_SEL
-#define BOOL _OS2_BOOL
-#define id _OS2_id
-#include <os2.h>
-#undef id
-#undef SEL
-#undef BOOL
-
-#include <stdlib.h>
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  return 0;
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  return 0;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
-{
-  int thread_id = 0;
-
-  if ((thread_id = _beginthread (func,NULL,32768,arg)) < 0)
-    thread_id = 0;
-  
-  return (objc_thread_t)thread_id;
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority(int priority)
-{
-  ULONG sys_class = 0;
-  ULONG sys_priority = 0;
-
-  /* OBJC_THREAD_INTERACTIVE_PRIORITY -> PRTYC_FOREGROUNDSERVER
-   * OBJC_THREAD_BACKGROUND_PRIORITY  -> PRTYC_REGULAR
-   * OBJC_THREAD_LOW_PRIORITY         -> PRTYC_IDLETIME */
-  
-  switch (priority) {
-  case OBJC_THREAD_INTERACTIVE_PRIORITY:
-    sys_class = PRTYC_REGULAR;
-    sys_priority = 10;
-    break;
-  default:
-  case OBJC_THREAD_BACKGROUND_PRIORITY:
-    sys_class = PRTYC_IDLETIME;
-    sys_priority = 25;
-    break;
-  case OBJC_THREAD_LOW_PRIORITY:
-    sys_class = PRTYC_IDLETIME;
-    sys_priority = 0;
-    break;
-  }
-
-  /* Change priority */
-  if (!DosSetPriority (PRTYS_THREAD,sys_class,sys_priority,*_threadid))
-    return 0;
-  else
-    return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  PTIB ptib;
-  PPIB ppib;
-
-  /* get information about current thread */
-  DosGetInfoBlocks (&ptib,&ppib);
-
-  switch (ptib->tib_ptib2->tib2_ulpri)
-    {
-    case PRTYC_IDLETIME:
-    case PRTYC_REGULAR:
-    case PRTYC_TIMECRITICAL:
-    case PRTYC_FOREGROUNDSERVER:
-    default:
-      return OBJC_THREAD_INTERACTIVE_PRIORITY;
-    }
-
-  return -1;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  DosSleep (0);
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  /* terminate the thread, NEVER use DosExit () */
-  _endthread ();
-
-  /* Failed if we reached here */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  return (objc_thread_t) *_threadid;
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  *_threadstore () = value;
-
-  return 0;
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  return *_threadstore ();
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  if (DosCreateMutexSem (NULL, (HMTX)(&(mutex->backend)),0L,0) > 0)
-    return -1;
-  else
-    return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  DosCloseMutexSem ((HMTX)(mutex->backend));
-  return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  if (DosRequestMutexSem ((HMTX)(mutex->backend),-1L) != 0)
-    return -1;
-  else
-    return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  if (DosRequestMutexSem ((HMTX)(mutex->backend),0L) != 0)
-    return -1;
-  else
-    return 0;
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  if (DosReleaseMutexSem((HMTX)(mutex->backend)) != 0)
-    return -1;
-  else
-    return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* End of File */
diff --git a/libobjc/thr-posix.c b/libobjc/thr-posix.c
deleted file mode 100644 (file)
index 6e60614..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-/* GNU Objective C Runtime Thread Interface for POSIX compliant threads
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
-   Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-   Modified for Linux/Pthreads by Kai-Uwe Sattler (kus@iti.cs.uni-magdeburg.de)
-   Modified for posix compliance by Chris Ball (cball@fmco.com)
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include "objc/thr.h"
-#include "objc/runtime.h"
-#include <pthread.h>
-
-/* Key structure for maintaining thread specific storage */
-static pthread_key_t _objc_thread_storage;
-static pthread_attr_t _objc_thread_attribs;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  /* Initialize the thread storage key */
-  if (pthread_key_create(&_objc_thread_storage, NULL) == 0)
-    {
-      /*
-       * The normal default detach state for threads is PTHREAD_CREATE_JOINABLE
-       * which causes threads to not die when you think they should.
-          */
-      if (pthread_attr_init(&_objc_thread_attribs) == 0)
-        {
-          if (pthread_attr_setdetachstate(&_objc_thread_attribs, 
-                                          PTHREAD_CREATE_DETACHED) == 0)
-            return 0;
-        }
-    }
-
-  return -1;
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  if (pthread_key_delete(_objc_thread_storage) == 0)
-    {
-      if (pthread_attr_destroy(&_objc_thread_attribs) == 0)
-        return 0;
-    }
-
-  return -1;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
-{
-  objc_thread_t thread_id;
-  pthread_t new_thread_handle;
-  
-  if (!(pthread_create(&new_thread_handle, &_objc_thread_attribs, 
-                       (void *)func, arg)))
-    thread_id = *(objc_thread_t *)&new_thread_handle;
-  else
-    thread_id = NULL;
-  
-  return thread_id;
-}
-
-/* Set the current thread's priority.
- *
- * Be aware that the default schedpolicy often disallows thread priorities.
- */
-int
-__objc_thread_set_priority(int priority)
-{
-  pthread_t thread_id = pthread_self();
-  int policy;
-  struct sched_param params;
-  int priority_min, priority_max;
-
-  if (pthread_getschedparam(thread_id, &policy, &params) == 0)
-    {
-      if ((priority_max = sched_get_priority_max(policy)) != 0)
-        return -1;
-
-      if ((priority_min = sched_get_priority_min(policy)) != 0)
-        return -1;
-
-      if (priority > priority_max)
-        priority = priority_max;
-      else if (priority < priority_min)
-        priority = priority_min;
-      params.sched_priority = priority;
-
-      /*
-       * The solaris 7 and several other man pages incorrectly state that
-       * this should be a pointer to policy but pthread.h is universally
-       * at odds with this.
-       */
-      if (pthread_setschedparam(thread_id, policy, &params) == 0)
-        return 0;
-    }
-  return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  int policy;
-  struct sched_param params;
-
-  if (pthread_getschedparam(pthread_self(), &policy, &params) == 0)
-    return params.sched_priority;
-  else
-    return -1;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  sched_yield();
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  /* exit the thread */
-  pthread_exit(&__objc_thread_exit_status);
-
-  /* Failed if we reached here */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  pthread_t self = pthread_self();
-
-  return *(objc_thread_t *)&self;
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  if (pthread_setspecific(_objc_thread_storage, value) == 0)
-    return 0;
-  else
-    return -1;
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  return pthread_getspecific(_objc_thread_storage);
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  mutex->backend = objc_malloc(sizeof(pthread_mutex_t));
-
-  if (pthread_mutex_init((pthread_mutex_t *)mutex->backend, NULL))
-    {
-      objc_free(mutex->backend);
-      mutex->backend = NULL;
-      return -1;
-    }
-
-  return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  int count = 1;
-
-  /*
-   * Posix Threads specifically require that the thread be unlocked for
-   * pthread_mutex_destroy to work.
-   */
-
-  while (count)
-    {
-      if ((count = pthread_mutex_unlock((pthread_mutex_t*)mutex->backend)) < 0)
-        return -1;
-    }
-
-  if (pthread_mutex_destroy((pthread_mutex_t *)mutex->backend))
-    return -1;
-
-  objc_free(mutex->backend);
-  mutex->backend = NULL;
-  return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  if (pthread_mutex_lock((pthread_mutex_t *)mutex->backend) == 0)
-    return 0;
-  else
-    return -1;
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  if (pthread_mutex_trylock((pthread_mutex_t *)mutex->backend) == 0)
-    return 0;
-  else
-    return -1;
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  if (pthread_mutex_unlock((pthread_mutex_t *)mutex->backend) == 0)
-    return 0;
-  else
-    return -1;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  condition->backend = objc_malloc(sizeof(pthread_cond_t));
-
-  if (pthread_cond_init((pthread_cond_t *)condition->backend, NULL))
-    {
-      objc_free(condition->backend);
-      condition->backend = NULL;
-      return -1;
-    }
-
-  return 0;
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  if (pthread_cond_destroy((pthread_cond_t *)condition->backend))
-    return -1;
-
-  objc_free(condition->backend);
-  condition->backend = NULL;
-  return 0;
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  if (pthread_cond_wait((pthread_cond_t *)condition->backend,
-                        (pthread_mutex_t *)mutex->backend) == 0)
-    return 0;
-  else
-    return -1;
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  if (pthread_cond_broadcast((pthread_cond_t *)condition->backend) == 0)
-    return 0;
-  else
-    return -1;
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  if (pthread_cond_signal((pthread_cond_t *)condition->backend) == 0)
-    return 0;
-  else
-    return -1;
-}
diff --git a/libobjc/thr-pthreads.c b/libobjc/thr-pthreads.c
deleted file mode 100644 (file)
index d0a46f8..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-/* GNU Objective C Runtime Thread Implementation for PCThreads under GNU/Linux.
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
-   Contributed by Scott Christley <scottc@net-community.com>
-   Condition functions added by: Mircea Oancea <mircea@first.elcom.pub.ro>
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include <pcthread.h>
-#include "objc/thr.h"
-#include "objc/runtime.h"
-
-/* Key structure for maintaining thread specific storage */
-static pthread_key_t _objc_thread_storage;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  /* Initialize the thread storage key */
-  return pthread_key_create(&_objc_thread_storage, NULL);
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  /* Destroy the thread storage key */
-  /* Not implemented yet */
-  /* return pthread_key_delete(&_objc_thread_storage); */
-  return 0;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
-{
-  objc_thread_t thread_id;
-  pthread_t new_thread_handle;
-
-  if ( !(pthread_create(&new_thread_handle, NULL, (void *)func, arg)) )
-      thread_id = *(objc_thread_t *)&new_thread_handle;
-  else
-    thread_id = NULL;
-  
-  return thread_id;
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority(int priority)
-{
-  /* Not implemented yet */
-  return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  /* Not implemented yet */
-  return OBJC_THREAD_INTERACTIVE_PRIORITY;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  pthread_yield(NULL);
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  /* exit the thread */
-  pthread_exit(&__objc_thread_exit_status);
-
-  /* Failed if we reached here */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  pthread_t self = pthread_self();
-
-  return *(objc_thread_t *)&self;
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  return pthread_setspecific(_objc_thread_storage, value);
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  void *value = NULL;
-
-  if ( !(pthread_getspecific(_objc_thread_storage, &value)) )
-    return value;
-
-  return NULL;
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), NULL))
-    return -1;
-  else
-    return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend))))
-    return -1;
-  else
-    return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend)));
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  return pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend)));
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend)));
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL))
-    return -1;
-  else
-    return 0;
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend)));
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)),
-                          (pthread_mutex_t *)(&(mutex->backend)));
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend)));
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  return pthread_cond_signal((pthread_cond_t *)(&(condition->backend)));
-}
-
-/* End of File */
diff --git a/libobjc/thr-rtems.c b/libobjc/thr-rtems.c
deleted file mode 100644 (file)
index cb2e68d..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/* GNU Objective C Runtime Thread Implementation
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
-   Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-   Renamed from thr-vxworks.c to thr-rtems.c by 
-     Ralf Corsepius (corsepiu@faw.uni-ulm.de)
-     
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include "objc/thr.h"
-#include "objc/runtime.h"
-
-/* Thread local storage for a single thread */
-static void *thread_local_storage = NULL;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  /* No thread support available */
-  return -1;
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  /* No thread support available */
-  return -1;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
-{
-  /* No thread support available */
-  return NULL;
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority(int priority)
-{
-  /* No thread support available */
-  return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  return OBJC_THREAD_INTERACTIVE_PRIORITY;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  return;
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  /* No thread support available */
-  /* Should we really exit the program */
-  /* exit(&__objc_thread_exit_status); */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  /* No thread support, use 1. */
-  return (objc_thread_t)1;
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  thread_local_storage = value;
-  return 0;
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  return thread_local_storage;
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  /* There can only be one thread, so we always get the lock */
-  return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  /* There can only be one thread, so we always get the lock */
-  return 0;
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* End of File */
diff --git a/libobjc/thr-single.c b/libobjc/thr-single.c
deleted file mode 100644 (file)
index 0074c69..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/* GNU Objective C Runtime Thread Implementation
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
-   Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include "objc/thr.h"
-#include "objc/runtime.h"
-
-/* Thread local storage for a single thread */
-static void *thread_local_storage = NULL;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  /* No thread support available */
-  return -1;
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  /* No thread support available */
-  return -1;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
-{
-  /* No thread support available */
-  return NULL;
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority(int priority)
-{
-  /* No thread support available */
-  return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  return OBJC_THREAD_INTERACTIVE_PRIORITY;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  return;
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  /* No thread support available */
-  /* Should we really exit the program */
-  /* exit(&__objc_thread_exit_status); */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  /* No thread support, use 1. */
-  return (objc_thread_t)1;
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  thread_local_storage = value;
-  return 0;
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  return thread_local_storage;
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  /* There can only be one thread, so we always get the lock */
-  return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  /* There can only be one thread, so we always get the lock */
-  return 0;
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* End of File */
diff --git a/libobjc/thr-solaris.c b/libobjc/thr-solaris.c
deleted file mode 100644 (file)
index a08dabe..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-/* GNU Objective C Runtime Thread Interface
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
-   Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-   Conditions added by Mircea Oancea (mircea@first.elcom.pub.ro)
-      
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include "objc/thr.h"
-#include "objc/runtime.h"
-
-#include <thread.h>
-#include <synch.h>
-#include <errno.h>
-
-/* Key structure for maintaining thread specific storage */
-static thread_key_t     __objc_thread_data_key;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  /* Initialize the thread storage key */
-  if (thr_keycreate(&__objc_thread_data_key, NULL) == 0)
-    return 0;
-  else
-    return -1;
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  return 0;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
-{
-  objc_thread_t thread_id;
-  thread_t new_thread_id = 0;
-
-  if (thr_create(NULL, 0, (void *)func, arg,
-                 THR_DETACHED | THR_NEW_LWP,
-                 &new_thread_id) == 0)
-    thread_id = *(objc_thread_t *)&new_thread_id;
-  else
-    thread_id = NULL;
-  
-  return thread_id;
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority(int priority)
-{
-  int sys_priority = 0;
-
-  switch (priority)
-    {
-    case OBJC_THREAD_INTERACTIVE_PRIORITY:
-      sys_priority = 300;
-      break;
-    default:
-    case OBJC_THREAD_BACKGROUND_PRIORITY:
-      sys_priority = 200;
-      break;
-    case OBJC_THREAD_LOW_PRIORITY:
-      sys_priority = 1000;
-      break;
-    }
-
-  /* Change priority */
-  if (thr_setprio(thr_self(), sys_priority) == 0)
-    return 0;
-  else
-    return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  int sys_priority;
-                                                   
-  if (thr_getprio(thr_self(), &sys_priority) == 0)
-    {
-      if (sys_priority >= 250)
-       return OBJC_THREAD_INTERACTIVE_PRIORITY;
-      else if (sys_priority >= 150)
-       return OBJC_THREAD_BACKGROUND_PRIORITY;
-      return OBJC_THREAD_LOW_PRIORITY;
-    }
-
-  /* Couldn't get priority. */
-  return -1;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  thr_yield();
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  /* exit the thread */
-  thr_exit(&__objc_thread_exit_status);
-
-  /* Failed if we reached here */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  return (objc_thread_t)thr_self();
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  if (thr_setspecific(__objc_thread_data_key, value) == 0)
-    return 0;
-  else
-    return -1;
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  void *value = NULL;
-
-  if (thr_getspecific(__objc_thread_data_key, &value) == 0)
-    return value;
-
-  return NULL;
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  if (mutex_init( (mutex_t *)(&(mutex->backend)), USYNC_THREAD, 0))
-    return -1;
-  else
-    return 0;
-}
-
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  mutex_destroy((mutex_t *)(&(mutex->backend)));
-  return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  if (mutex_lock((mutex_t *)(&(mutex->backend))) != 0)
-    return -1;
-  else
-    return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  if (mutex_trylock((mutex_t *)(&(mutex->backend))) != 0)
-    return -1;
-  else
-    return 0;
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  if (mutex_unlock((mutex_t *)(&(mutex->backend))) != 0)
-    return -1;
-  else
-    return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  return cond_init((cond_t *)(&(condition->backend)), USYNC_THREAD, NULL);
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  return cond_destroy((cond_t *)(&(condition->backend)));
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  return cond_wait((cond_t *)(&(condition->backend)),
-                  (mutex_t *)(&(mutex->backend)));
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  return cond_broadcast((cond_t *)(&(condition->backend)));
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  return cond_signal((cond_t *)(&(condition->backend)));
-}
-
-/* End of File */
diff --git a/libobjc/thr-vxworks.c b/libobjc/thr-vxworks.c
deleted file mode 100644 (file)
index 0074c69..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/* GNU Objective C Runtime Thread Implementation
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
-   Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include "objc/thr.h"
-#include "objc/runtime.h"
-
-/* Thread local storage for a single thread */
-static void *thread_local_storage = NULL;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  /* No thread support available */
-  return -1;
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  /* No thread support available */
-  return -1;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
-{
-  /* No thread support available */
-  return NULL;
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority(int priority)
-{
-  /* No thread support available */
-  return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  return OBJC_THREAD_INTERACTIVE_PRIORITY;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  return;
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  /* No thread support available */
-  /* Should we really exit the program */
-  /* exit(&__objc_thread_exit_status); */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  /* No thread support, use 1. */
-  return (objc_thread_t)1;
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  thread_local_storage = value;
-  return 0;
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  return thread_local_storage;
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  /* There can only be one thread, so we always get the lock */
-  return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  /* There can only be one thread, so we always get the lock */
-  return 0;
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  return 0;
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  return 0;
-}
-
-/* End of File */
diff --git a/libobjc/thr-win32.c b/libobjc/thr-win32.c
deleted file mode 100644 (file)
index 2d2f31e..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-/* GNU Objective C Runtime Thread Interface - Win32 Implementation
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
-   Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3, or (at your option) any later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-
-#include "objc/thr.h"
-#include "objc/runtime.h"
-
-#ifndef __OBJC__
-#define __OBJC__
-#endif
-#include <windows.h>
-
-/* Key structure for maintaining thread specific storage */
-static DWORD   __objc_data_tls = (DWORD)-1;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__objc_init_thread_system(void)
-{
-  /* Initialize the thread storage key */
-  if ((__objc_data_tls = TlsAlloc()) != (DWORD)-1)
-    return 0;
-  else
-    return -1;
-}
-
-/* Close the threads subsystem. */
-int
-__objc_close_thread_system(void)
-{
-  if (__objc_data_tls != (DWORD)-1)
-    TlsFree(__objc_data_tls);
-  return 0;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__objc_thread_detach(void (*func)(void *arg), void *arg)
-{
-  DWORD        thread_id = 0;
-  HANDLE win32_handle;
-
-  if (!(win32_handle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func,
-                                   arg, 0, &thread_id)))
-    thread_id = 0;
-  
-  return (objc_thread_t)(size_t) thread_id;
-}
-
-/* Set the current thread's priority. */
-int
-__objc_thread_set_priority(int priority)
-{
-  int sys_priority = 0;
-
-  switch (priority)
-    {
-    case OBJC_THREAD_INTERACTIVE_PRIORITY:
-      sys_priority = THREAD_PRIORITY_NORMAL;
-      break;
-    default:
-    case OBJC_THREAD_BACKGROUND_PRIORITY:
-      sys_priority = THREAD_PRIORITY_BELOW_NORMAL;
-      break;
-    case OBJC_THREAD_LOW_PRIORITY:
-      sys_priority = THREAD_PRIORITY_LOWEST;
-      break;
-    }
-
-  /* Change priority */
-  if (SetThreadPriority(GetCurrentThread(), sys_priority))
-    return 0;
-  else
-    return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__objc_thread_get_priority(void)
-{
-  int sys_priority;
-
-  sys_priority = GetThreadPriority(GetCurrentThread());
-  
-  switch (sys_priority)
-    {
-    case THREAD_PRIORITY_HIGHEST:
-    case THREAD_PRIORITY_TIME_CRITICAL:
-    case THREAD_PRIORITY_ABOVE_NORMAL:
-    case THREAD_PRIORITY_NORMAL:
-      return OBJC_THREAD_INTERACTIVE_PRIORITY;
-
-    default:
-    case THREAD_PRIORITY_BELOW_NORMAL:
-      return OBJC_THREAD_BACKGROUND_PRIORITY;
-    
-    case THREAD_PRIORITY_IDLE:
-    case THREAD_PRIORITY_LOWEST:
-      return OBJC_THREAD_LOW_PRIORITY;
-    }
-
-  /* Couldn't get priority. */
-  return -1;
-}
-
-/* Yield our process time to another thread. */
-void
-__objc_thread_yield(void)
-{
-  Sleep(0);
-}
-
-/* Terminate the current thread. */
-int
-__objc_thread_exit(void)
-{
-  /* exit the thread */
-  ExitThread(__objc_thread_exit_status);
-
-  /* Failed if we reached here */
-  return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__objc_thread_id(void)
-{
-  return (objc_thread_t)(size_t) GetCurrentThreadId();
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__objc_thread_set_data(void *value)
-{
-  if (TlsSetValue(__objc_data_tls, value))
-    return 0;
-  else
-    return -1;
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__objc_thread_get_data(void)
-{
-  return TlsGetValue(__objc_data_tls);          /* Return thread data.      */
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__objc_mutex_allocate(objc_mutex_t mutex)
-{
-  if ((mutex->backend = (void *)CreateMutex(NULL, 0, NULL)) == NULL)
-    return -1;
-  else
-    return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__objc_mutex_deallocate(objc_mutex_t mutex)
-{
-  CloseHandle((HANDLE)(mutex->backend));
-  return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__objc_mutex_lock(objc_mutex_t mutex)
-{
-  int status;
-
-  status = WaitForSingleObject((HANDLE)(mutex->backend), INFINITE);
-  if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED)
-    return -1;
-  else
-    return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__objc_mutex_trylock(objc_mutex_t mutex)
-{
-  int status;
-
-  status = WaitForSingleObject((HANDLE)(mutex->backend), 0);
-  if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED)
-    return -1;
-  else
-    return 0;
-}
-
-/* Unlock the mutex */
-int
-__objc_mutex_unlock(objc_mutex_t mutex)
-{
-  if (ReleaseMutex((HANDLE)(mutex->backend)) == 0)
-    return -1;
-  else
-    return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__objc_condition_allocate(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Deallocate a condition. */
-int
-__objc_condition_deallocate(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Wait on the condition */
-int
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__objc_condition_broadcast(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__objc_condition_signal(objc_condition_t condition)
-{
-  /* Unimplemented. */
-  return -1;
-}
-
-/* End of File */
index a12aa2d..4bdbb5d 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU Objective C Runtime Thread Interface
-   Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2009, 2010 Free Software Foundation, Inc.
    Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
 
 This file is part of GCC.
@@ -22,9 +22,24 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define _LIBOBJC
+/* The line below is needed for declarations of functions such as
+   pthread_mutexattr_settype, without which gthr-posix.h may fail to
+   compile within libobjc.  Unfortunately, this breaks compilation on
+   Tru64 UNIX V4.0F, so disable it there.  */
+#ifndef __osf__
+#define _XOPEN_SOURCE 500
+#endif
+#include "config.h"
+#include "tconfig.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "defaults.h"
+#include "objc/thr.h"
+#include "objc/runtime.h"
+#include <gthr.h>
 
 #include <stdlib.h>
-#include "objc/runtime.h"
 
 /* Global exit status. */
 int __objc_thread_exit_status = 0;
@@ -61,6 +76,13 @@ objc_thread_callback objc_set_thread_callback (objc_thread_callback func)
   considered part of the public interface.
   */
 
+/* Initialize the threads subsystem. */
+int
+__objc_init_thread_system(void)
+{
+  return __gthread_objc_init_thread_system ();
+}
+
 /*
   First function called in a thread, starts everything else.
 
@@ -152,8 +174,8 @@ objc_thread_detach (SEL selector, id object, id argument)
   objc_mutex_lock (__objc_runtime_mutex);
 
   /* Call the backend to spawn the thread */
-  if ((thread_id = __objc_thread_detach ((void *)__objc_thread_detach_function,
-                                        istate)) == NULL)
+  if ((thread_id = __gthread_objc_thread_detach ((void *)__objc_thread_detach_function,
+                                                istate)) == NULL)
     {
       /* failed! */
       objc_mutex_unlock (__objc_runtime_mutex);
@@ -173,7 +195,7 @@ int
 objc_thread_set_priority (int priority)
 {
   /* Call the backend */
-  return __objc_thread_set_priority (priority);
+  return __gthread_objc_thread_set_priority (priority);
 }
 
 /* Return the current thread's priority. */
@@ -181,7 +203,7 @@ int
 objc_thread_get_priority (void)
 {
   /* Call the backend */
-  return __objc_thread_get_priority ();
+  return __gthread_objc_thread_get_priority ();
 }
 
 /*
@@ -193,7 +215,7 @@ void
 objc_thread_yield (void)
 {
   /* Call the backend */
-  __objc_thread_yield ();
+  __gthread_objc_thread_yield ();
 }
 
 /*
@@ -209,7 +231,7 @@ objc_thread_exit (void)
   objc_mutex_unlock (__objc_runtime_mutex);
 
   /* Call the backend to terminate the thread */
-  return __objc_thread_exit ();
+  return __gthread_objc_thread_exit ();
 }
 
 /*
@@ -220,7 +242,7 @@ objc_thread_t
 objc_thread_id (void)
 {
   /* Call the backend */
-  return __objc_thread_id ();
+  return __gthread_objc_thread_id ();
 }
 
 /*
@@ -231,7 +253,7 @@ int
 objc_thread_set_data (void *value)
 {
   /* Call the backend */
-  return __objc_thread_set_data (value);
+  return __gthread_objc_thread_set_data (value);
 }
 
 /*
@@ -241,7 +263,7 @@ void *
 objc_thread_get_data (void)
 {
   /* Call the backend */
-  return __objc_thread_get_data ();
+  return __gthread_objc_thread_get_data ();
 }
 
 /* Frontend mutex functions */
@@ -260,7 +282,7 @@ objc_mutex_allocate (void)
     return NULL;
 
   /* Call backend to create the mutex */
-  if (__objc_mutex_allocate (mutex))
+  if (__gthread_objc_mutex_allocate (mutex))
     {
       /* failed! */
       objc_free (mutex);
@@ -293,7 +315,7 @@ objc_mutex_deallocate (objc_mutex_t mutex)
   depth = objc_mutex_lock (mutex);
 
   /* Call backend to destroy mutex */
-  if (__objc_mutex_deallocate (mutex))
+  if (__gthread_objc_mutex_deallocate (mutex))
     return -1;
 
   /* Free the mutex structure */
@@ -320,12 +342,12 @@ objc_mutex_lock (objc_mutex_t mutex)
     return -1;
 
   /* If we already own the lock then increment depth */
-  thread_id = __objc_thread_id ();
+  thread_id = __gthread_objc_thread_id ();
   if (mutex->owner == thread_id)
     return ++mutex->depth;
 
   /* Call the backend to lock the mutex */
-  status = __objc_mutex_lock (mutex);
+  status = __gthread_objc_mutex_lock (mutex);
 
   /* Failed? */
   if (status)
@@ -352,12 +374,12 @@ objc_mutex_trylock (objc_mutex_t mutex)
     return -1;
 
   /* If we already own the lock then increment depth */ 
-  thread_id = __objc_thread_id ();
+  thread_id = __gthread_objc_thread_id ();
   if (mutex->owner == thread_id)
     return ++mutex->depth;
     
   /* Call the backend to try to lock the mutex */
-  status = __objc_mutex_trylock (mutex);
+  status = __gthread_objc_mutex_trylock (mutex);
 
   /* Failed? */
   if (status)
@@ -387,7 +409,7 @@ objc_mutex_unlock (objc_mutex_t mutex)
     return -1;
 
   /* If another thread owns the lock then abort */
-  thread_id = __objc_thread_id ();
+  thread_id = __gthread_objc_thread_id ();
   if (mutex->owner != thread_id)
     return -1;
 
@@ -400,7 +422,7 @@ objc_mutex_unlock (objc_mutex_t mutex)
   mutex->owner = NULL;
 
   /* Have the backend unlock the mutex */
-  status = __objc_mutex_unlock (mutex);
+  status = __gthread_objc_mutex_unlock (mutex);
 
   /* Failed? */
   if (status)
@@ -426,7 +448,7 @@ objc_condition_allocate (void)
     return NULL;
 
   /* Call the backend to create the condition mutex */
-  if (__objc_condition_allocate (condition))
+  if (__gthread_objc_condition_allocate (condition))
     {
       /* failed! */
       objc_free (condition);
@@ -452,7 +474,7 @@ objc_condition_deallocate (objc_condition_t condition)
     return -1;
 
   /* Call the backend to destroy */
-  if (__objc_condition_deallocate (condition))
+  if (__gthread_objc_condition_deallocate (condition))
     return -1;
 
   /* Free the condition mutex structure */
@@ -479,7 +501,7 @@ objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
     return -1;
 
   /* Make sure we are owner of mutex */
-  thread_id = __objc_thread_id ();
+  thread_id = __gthread_objc_thread_id ();
   if (mutex->owner != thread_id)
     return -1;
 
@@ -492,7 +514,7 @@ objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
   mutex->owner = (objc_thread_t)NULL;
 
   /* Call the backend to wait */
-  __objc_condition_wait (condition, mutex);
+  __gthread_objc_condition_wait (condition, mutex);
 
   /* Make ourselves owner of the mutex */
   mutex->owner = thread_id;
@@ -514,7 +536,7 @@ objc_condition_broadcast (objc_condition_t condition)
   if (! condition)
     return -1;
 
-  return __objc_condition_broadcast (condition);
+  return __gthread_objc_condition_broadcast (condition);
 }
 
 /*
@@ -530,7 +552,7 @@ objc_condition_signal (objc_condition_t condition)
   if (! condition)
     return -1;
 
-  return __objc_condition_signal (condition);
+  return __gthread_objc_condition_signal (condition);
 }
 
 /* Make the objc thread system aware that a thread which is managed