harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r350181 [166/198] - in /incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core: ./ depends/ depends/files/ depends/jars/ depends/libs/ depends/libs/linux.IA32/ depends/libs/win.IA32/ depends/oss/ depends/oss/linux.IA32/ depends/oss/win....
Date Thu, 01 Dec 2005 06:04:00 GMT
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/hythreadinspect.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/hythreadinspect.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/hythreadinspect.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/hythreadinspect.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,283 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * @ingroup Thread
+ */
+
+/*
+ * This file contains thread routines which are compiled twice -- once for in-process, and
+ * once for out-of-process uses (e.g. debug extensions).
+ * The APIs in this file are only used for inspecting threads -- not for modifying them
+ */
+
+#if defined(HYVM_OUT_OF_PROCESS)
+#include "hydbgext.h"
+#endif
+
+#include "threaddef.h"
+
+#if defined(HYVM_OUT_OF_PROCESS)
+#define READU(field) dbgReadUDATA((UDATA*)&(field))
+#define READP(field) ((void*)dbgReadUDATA((UDATA*)&(field)))
+#undef MUTEX_ENTER
+#define MUTEX_ENTER(a)
+#undef MUTEX_EXIT
+#define MUTEX_EXIT(a)
+#undef GLOBAL_LOCK
+#define GLOBAL_LOCK(a, b)
+#undef GLOBAL_UNLOCK
+#define GLOBAL_UNLOCK(a)
+#else /* defined (HYVM_OUT_OF_PROCESS) */
+#define READU(field) ((UDATA)(field))
+#define READP(field) (field)
+#endif
+
+#define CDEV_CURRENT_FUNCTION _prototypes_private
+static hythread_monitor_pool_t pool_for_monitor
+PROTOTYPE ((hythread_library_t lib, hythread_monitor_t monitor));
+static hythread_library_t get_default_library PROTOTYPE ((void));
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_monitor_walk
+/** 
+ * Walk all active monitors.
+ *
+ * @param[in] monitor If NULL, the first monitor is returned and the monitor pool is locked (thread lib is globally locked)<br> 
+ * If non-NULL, the next monitor is returned.
+ * @return a pointer to a monitor, or NULL if all monitors walked (and thread lib is globally unlocked).
+ * 
+ * @note As this is currently implemented, this must be called to walk ALL monitors. It can't
+ * be used to look for a specific monitor and then quit.
+ * 
+ */
+hythread_monitor_t VMCALL
+hythread_monitor_walk (hythread_monitor_t monitor)
+{
+  hythread_monitor_pool_t pool;
+  hythread_library_t lib = get_default_library ();
+
+  ASSERT (lib);
+  ASSERT (lib->monitor_pool);
+  ASSERT (lib->monitor_pool->entries);
+  ASSERT (MACRO_SELF () != 0);
+
+  if (monitor == NULL)
+    {
+      GLOBAL_LOCK (MACRO_SELF (), CALLER_MONITOR_WALK);
+      pool = READP (lib->monitor_pool);
+      monitor = &pool->entries[0];
+      if (READU (monitor->count) != FREE_TAG)
+        return monitor;
+    }
+  else
+    {
+      pool = pool_for_monitor (lib, monitor);
+      if (pool == NULL)
+        {
+          /* should never happen */
+          GLOBAL_UNLOCK (MACRO_SELF ());
+          return NULL;
+        }
+    }
+
+  do
+    {
+      if (monitor >= &pool->entries[MONITOR_POOL_SIZE - 1])
+        {
+          if ((pool = READP (pool->next)) == NULL)
+            {
+              /* we've walked all monitors */
+              GLOBAL_UNLOCK (MACRO_SELF ());
+              return NULL;
+            }
+          monitor = &pool->entries[0];
+        }
+      else
+        {
+          monitor++;
+        }
+    }
+  while (READU (monitor->count) == FREE_TAG);
+
+  return monitor;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_tls_get
+/** 
+ * Get a thread's thread local storage (TLS) value.
+ *
+ * @param[in] a thread
+ * @param[in] key key to have TLS value returned (value returned by hythread_tls_alloc)
+ * @return pointer to location of TLS or NULL on failure.
+ *  
+ */
+void *VMCALL
+hythread_tls_get (hythread_t thread, hythread_tls_key_t key)
+{
+  return (void *) READU (thread->tls[key - 1]);
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION pool_for_monitor
+/* 
+ * Return the monitor pool holding a monitor.
+ * 
+ * @param[in] lib threading library (non-NULL)
+ * @param[in] monitor
+ * @return pointer to pool on success, NULL on failure (invalid monitor?)
+ */
+static hythread_monitor_pool_t
+pool_for_monitor (hythread_library_t lib, hythread_monitor_t monitor)
+{
+  hythread_monitor_pool_t pool = READP (lib->monitor_pool);
+
+  /* find out which pool the monitor is from (cache this, maybe?) 
+     (NOTE: technically, this search invokes undefined behaviour (comparing pointers from different
+     malloc's).  But it should work on every platform with a flat memory model. */
+
+  ASSERT (lib);
+  ASSERT (monitor);
+  ASSERT (pool);
+
+  while (monitor < &pool->entries[0]
+         || monitor > &pool->entries[MONITOR_POOL_SIZE - 1])
+    {
+      if ((pool = READP (pool->next)) == NULL)
+        {
+          break;
+        }
+    }
+
+  return pool;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_get_priority
+/** 
+ * Return a thread's scheduling priority.
+ * 
+ * @param[in] thread (non-NULL)
+ * @return scheduling priority
+ * @see hythread_create, hythread_set_priority
+ *
+ */
+UDATA VMCALL
+hythread_get_priority (hythread_t thread)
+{
+  ASSERT (thread);
+  return READU (thread->priority);
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_get_flags
+/** 
+ * Return a thread's flags.
+ * 
+ * @param[in] thread (non-NULL)
+ * @param[in] blocker if non-NULL, will be set to the monitor on which the thread is blocked (if any)
+ * @return flags
+ * 
+ */
+UDATA VMCALL
+hythread_get_flags (hythread_t thread, hythread_monitor_t * blocker)
+{
+  UDATA flags;
+
+  ASSERT (thread);
+
+  MUTEX_ENTER (thread->mutex);
+
+  if (blocker)
+    {
+      *blocker = READP (thread->monitor);
+    }
+  flags = READU (thread->flags);
+
+  MUTEX_EXIT (thread->mutex);
+
+  return flags;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_monitor_get_name
+/**
+ * Return a monitor's name.
+ * 
+ * @param[in] monitor (non-NULL)
+ * @return pointer to the monitor's name (may be NULL)
+ * 
+ * @see hythread_monitor_init_with_name
+ * 
+ */
+char *VMCALL
+hythread_monitor_get_name (hythread_monitor_t monitor)
+{
+  ASSERT (monitor);
+  return READP (monitor->name);
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_monitor_get_tracing
+
+/*
+ * Return a monitor's tracing information.
+ * 
+ * @param[in] monitor (non-NULL)
+ * @return pointer to the monitor's tracing information (may be NULL)
+ * 
+ */
+HyThreadMonitorTracing *VMCALL
+hythread_monitor_get_tracing (hythread_monitor_t monitor)
+{
+  ASSERT (monitor);
+
+  return READP (monitor->tracing);
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION getDefaultLibrary
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION get_default_library
+/* 
+ * Return the default threading library.
+ * 
+ * @return pointer to the default threading library
+ * 
+ */
+static hythread_library_t
+get_default_library (void)
+{
+#if defined(HYVM_OUT_OF_PROCESS)
+  return dbgGetThreadLibrary ();
+#else
+  return GLOBAL_DATA (default_library);
+#endif
+
+}
+
+#undef CDEV_CURRENT_FUNCTION

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/hythreadinspect.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/hythreadinspect.h?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/hythreadinspect.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/hythreadinspect.h Wed Nov 30 21:29:27 2005
@@ -0,0 +1,45 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(hythreadinspect_h)
+#define hythreadinspect_h
+
+#if defined(HYVM_OUT_OF_PROCESS)
+/* redefine thread functions */
+#define hythread_monitor_walk dbg_hythread_monitor_walk
+#define hythread_tls_get dbg_hythread_tls_get
+#define hythread_get_priority dbg_hythread_get_priority
+#define hythread_get_flags dbg_hythread_get_flags
+#define hythread_monitor_get_name dbg_hythread_monitor_get_name
+#define hythread_monitor_get_tracing dbg_hythread_monitor_get_tracing
+#define getVMThreadStatus dbgGetVMThreadStatus
+#endif
+
+#endif /* hythreadinspect_h */
+
+/* Note: This section is NOT protected by #ifdefs.
+ * It may be safely included more than once.
+ */
+UDATA VMCALL hythread_get_flags
+PROTOTYPE ((hythread_t thread, hythread_monitor_t * blocker));
+HyThreadMonitorTracing *VMCALL hythread_monitor_get_tracing
+PROTOTYPE ((hythread_monitor_t monitor));
+UDATA VMCALL hythread_get_priority PROTOTYPE ((hythread_t thread));
+void *VMCALL hythread_tls_get
+PROTOTYPE ((hythread_t thread, hythread_tls_key_t key));
+char *VMCALL hythread_monitor_get_name
+PROTOTYPE ((hythread_monitor_t monitor));
+hythread_monitor_t VMCALL hythread_monitor_walk
+PROTOTYPE ((hythread_monitor_t monitor));

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/linuxonexit.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/linuxonexit.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/linuxonexit.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/linuxonexit.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,96 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if defined(LINUX)
+#include "linuxonexit.h"
+
+#include <signal.h>
+
+#define __USE_GNU
+#include <dlfcn.h>
+#undef __USE_GNU
+
+static void linux_on_exit_sig_handler PROTOTYPE ((int signum));
+static void linux_on_exit_hook PROTOTYPE ((int exit_code, void *opaque));
+static int linux_on_exit_code = -1;
+static void
+linux_on_exit_sig_handler (int signum)
+{
+  /* exit without trying to cleanup (ala exit()) since thats what got us into 
+   * this mess in the first place */
+  _exit (linux_on_exit_code);
+}
+
+static void
+linux_on_exit_hook (int exit_code, void *opaque)
+{
+  sigset_t set;
+  struct sigaction act;
+        /**
+         * Hook handler registered via on_exit(). Added as a resultion
+         * for buggy linux pthread lock handling on thread exit. 
+         *
+         * Note that this fix should be revisited/reversed on systems running NPTL
+         * threads. Ie glibc 2.3+ and 2.6 series kernels. It _is_ feasible that
+         * such a system could still use old linuxthreads depending on distribution.
+         */
+  /* Kill any previously set alarms */
+  alarm (0);
+
+  sigemptyset (&set);
+  act.sa_handler = linux_on_exit_sig_handler;
+  act.sa_flags = 0;
+  act.sa_mask = set;
+
+  sigaction (SIGALRM, &act, NULL);
+
+  /* Unblock SIGALRM */
+  sigemptyset (&set);
+  sigaddset (&set, SIGALRM);
+  sigprocmask (SIG_UNBLOCK, &set, NULL);
+
+  /* remember the correct exit code, to be passed to _exit() in case we dead lock */
+  linux_on_exit_code = exit_code;
+
+  /* signal an alarm in N seconds, ie thats how long we've got to exit */
+  alarm (5);
+}
+
+void
+linux_set_on_exit_hook (void)
+{
+  Dl_info dl_info;
+  int dl_result;
+  return;
+  dl_result = dladdr ((void *) linux_on_exit_hook, &dl_info);
+  if (dl_result)
+    {
+      /* best effort case, try to dlopen the .so where our on exit hook code resides.
+       * This is done in order to prevent it from ever being unloaded once the .so usage 
+       * reference counter drops to zero. This dlopen will incrament it (we never close it)
+       * thus never allowing an unload to occur */
+      dlopen (dl_info.dli_fname, RTLD_LAZY);
+    }
+  on_exit (linux_on_exit_hook, NULL);
+}
+#endif
+
+static void
+toAvoidCompilerWarnings (void)
+{
+  /* As stated. This is a common file for Unix platforms.
+     The alternative is to change all makefile generators */
+  return;
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/linuxonexit.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/linuxonexit.h?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/linuxonexit.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/linuxonexit.h Wed Nov 30 21:29:27 2005
@@ -0,0 +1,24 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(linuxonexit_h)
+#define linuxonexit_h
+
+#include "hycomp.h"
+
+static void toAvoidCompilerWarnings PROTOTYPE ((void));
+void linux_set_on_exit_hook PROTOTYPE ((void));
+
+#endif /* linuxonexit_h */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/makefile
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/makefile?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/makefile (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/makefile Wed Nov 30 21:29:27 2005
@@ -0,0 +1,68 @@
+# Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Makefile for module 'thread'
+#
+
+include ../makefile.include
+
+DLLFILENAME=libhythr.so# declaration
+
+DLLNAME=../libhythr.so# declaration
+
+LIBNAME=hythr# declaration
+
+LIBPATH=../lib/# declaration
+
+CFLAGS= -fpic  -DLINUX -D_REENTRANT -O1 -march=pentium3 -DIPv6_FUNCTION_SUPPORT  -DHYX86 -I../include  $(VMDEBUG)
+
+.SUFFIXES:.cpp
+.cpp.o:
+	$(CXX)  -fpic  -DLINUX -D_REENTRANT -O1 -march=pentium3 -fno-exceptions -fno-rtti -DIPv6_FUNCTION_SUPPORT  -DHYX86 -I../include  $(VMDEBUG) -c $<
+
+ASFLAGS= -o $@
+
+.SUFFIXES:.asm
+.asm.o:
+	perl ../masm2gas/masm2gas.pl   -I../include $*.asm
+	$(AS) $(ASFLAGS) -o $*.o $*.s
+	-rm $*.s
+
+BUILDFILES1 = thread_copyright.o thrhelp.o thrspinlock.o hythread.o hythreadinspect.o
+BUILDFILES2 = linuxonexit.o priority.o rasthrsup.o rwmutex.o
+BUILDFILES3 = thrcreate.o thrdsup.o thrprof.o
+
+SYSLIBFILES1 = -lpthread
+
+MDLLIBFILES1 = ../lib/libhypool.a ../lib/libhycommon.a
+
+all: \
+	 $(DLLNAME)
+
+BUILDLIB: $(DLLNAME)
+
+$(DLLNAME):\
+	$(BUILDFILES1) $(BUILDFILES2) $(BUILDFILES3) $(MDLLIBFILES1) 
+	 $(DLL_LD) -shared -Wl,--version-script,$(LIBNAME).exp -Wl,-soname=$(DLLFILENAME) $(VMLINK) -L.  -L../lib -o $(DLLNAME) \
+	$(BUILDFILES1) $(BUILDFILES2) $(BUILDFILES3) $(SYSLIBFILES1) -Xlinker --start-group \
+	-lhypool \
+	-lhycommon -Xlinker --end-group  -lc -lm -ldl
+
+quick:
+	$(MAKE)
+
+clean:
+	-rm -f *.o
+	-rm -f ../libhythr.so

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/priority.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/priority.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/priority.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/priority.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,133 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "thrdsup.h"
+
+#include <sched.h>              /* must be after <pthread.h> or DECUNIX kaks */
+
+#include <stdio.h>
+
+static int min, max;
+
+#if defined(HY_PRIORITY_MAP)
+const int priority_map[HYTHREAD_PRIORITY_MAX + 1] = HY_PRIORITY_MAP;
+#else
+int priority_map[HYTHREAD_PRIORITY_MAX + 1];
+void
+initialize_priority_map (void)
+{
+  int policy, rc;
+  policy = HY_DEFAULT_SCHED;
+  initialize_priority_range (0, HYTHREAD_PRIORITY_MAX, policy);
+}
+
+void
+initialize_priority_range (int range_start, int range_end, int policy)
+{
+  int delta, i, tmpmax, tmpmin, mid, midrange, tailcount;
+  max = sched_get_priority_max (policy);
+  min = sched_get_priority_min (policy);
+  if (max == min)
+    {
+      /* get this thread's priority and use that for all threads */
+      struct sched_param schedParam;
+      int currPolicy;
+      int rv =
+        pthread_getschedparam (pthread_self (), &currPolicy, &schedParam);
+      max = schedParam.sched_priority;
+      min = max;
+    }
+  /* give us some room to do some math */
+  tmpmax = max * 1024;
+  tmpmin = min * 1024;
+  mid = (tmpmin + tmpmax) / 2;
+  midrange = range_start + (range_end - range_start) / 2;
+  priority_map[range_start] = min;
+  delta = (mid - tmpmin) / midrange;
+  for (i = 1; i < midrange; i++)
+    {
+      priority_map[midrange - i] = (mid - delta * i) / 1024;
+    }
+  tailcount = range_end - midrange;
+  delta = (tmpmax - mid) / tailcount;
+  for (i = 0; i < tailcount; i++)
+    {
+      priority_map[midrange + i] = (mid + delta * i) / 1024;;
+    }
+  priority_map[range_end] = max;
+#if defined(DEBUG)
+  for (i = range_start; i <= range_end; i++)
+    {
+      printf ("prio %d: %d\n", i, priority_map[i]);
+    }
+#endif
+}
+#endif
+
+IDATA
+set_pthread_priority (pthread_t handle, IDATA priority)
+{
+  struct sched_param sched_param;
+  int policy, rc;
+
+  policy = HY_DEFAULT_SCHED;
+  sched_param.sched_priority = priority;
+  rc = pthread_setschedparam (handle, policy, &sched_param);
+  return rc;
+}
+
+void
+initialize_thread_priority (hythread_t thread)
+{
+  int policy, priority, i;
+  struct sched_param sched_param;
+
+  /* set the default value */
+  thread->priority = HYTHREAD_PRIORITY_NORMAL;
+
+  /* are we using priorities at all? */
+  if (priority_map[HYTHREAD_PRIORITY_MIN] ==
+      priority_map[HYTHREAD_PRIORITY_MAX])
+    return;
+
+  if (pthread_getschedparam (thread->handle, &policy, &sched_param))
+    {
+      /* the call failed */
+      return;
+    }
+
+  if (policy != HY_DEFAULT_SCHED)
+    {
+      /* printf ("Policy isn't SCHED_OTHER!\n"); */
+      /* what to do?? */
+      return;
+    }
+
+  /* on some platforms (i.e. Solaris) we get out of range values (e.g. 0) for threads with no explicitly set priority */
+  if (sched_param.sched_priority < min || sched_param.sched_priority > max)
+    {
+      return;
+    }
+
+  priority = sched_param.sched_priority;
+  for (i = HYTHREAD_PRIORITY_MIN; i <= HYTHREAD_PRIORITY_MAX; i++)
+    {
+      if (priority <= priority_map[i])
+        {
+          thread->priority = i;
+          return;
+        }
+    }
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/priority.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/priority.h?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/priority.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/priority.h Wed Nov 30 21:29:27 2005
@@ -0,0 +1,24 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(priority_h)
+#define priority_h
+#include "thrdsup.h"
+void initialize_priority_map PROTOTYPE ((void));
+void initialize_priority_range
+PROTOTYPE ((int range_start, int range_end, int policy));
+void initialize_thread_priority PROTOTYPE ((hythread_t thread));
+IDATA set_pthread_priority PROTOTYPE ((pthread_t handle, IDATA priority));
+#endif /* priority_h */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rasthrsup.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rasthrsup.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rasthrsup.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rasthrsup.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,41 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "rasthrsup.h"
+
+#include <pthread.h>
+
+#include "hycomp.h"
+
+UDATA
+Unix_GetKernelThreadID (void)
+{
+  pthread_t myThread = pthread_self ();
+
+  /*
+   * Convert the local pthread_t variable, which could be a structure or a scalar value, into a UDATA
+   * by getting its address, casting that to a UDATA pointer and then dereferencing to get the value
+   *
+   * The result seems to match the thread id observed in GDB...
+   */
+  if (sizeof (pthread_t) >= sizeof (UDATA))
+    {
+      return *((UDATA *) & myThread);
+    }
+  else
+    {
+      return 0;
+    }
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rasthrsup.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rasthrsup.h?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rasthrsup.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rasthrsup.h Wed Nov 30 21:29:27 2005
@@ -0,0 +1,20 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(rasthrsup_h)
+#define rasthrsup_h
+/* RAS_THREAD_ID */
+#define RAS_THREAD_ID() Unix_GetKernelThreadID()
+#endif /* rasthrsup_h */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rwmutex.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rwmutex.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rwmutex.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/rwmutex.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,252 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include "threaddef.h"
+
+#undef  ASSERT
+#define ASSERT(x) /**/
+  typedef struct RWMutex
+{
+  hythread_monitor_t syncMon;
+  IDATA status;
+  hythread_t writer;
+} RWMutex;
+
+#define ASSERT_RWMUTEX(m)\
+    ASSERT((m));\
+    ASSERT((m)->syncMon);
+
+#define RWMUTEX_STATUS_IDLE(m)     ((m)->status == 0)
+#define RWMUTEX_STATUS_READING(m)  ((m)->status > 0)
+#define RWMUTEX_STATUS_WRITING(m)  ((m)->status < 0)
+
+/**
+ * Acquire and initialize a new read/write mutex from the threading library.
+ *
+ * @param[out] handle pointer to a hythread_rwmutex_t to be set to point to the new mutex
+ * @param[in] flags initial flag values for the mutex
+ * @return 0 on success, negative value on failure
+ * 
+ * @see hythread_rwmutex_destroy
+ */
+IDATA VMCALL
+hythread_rwmutex_init (hythread_rwmutex_t * handle, UDATA flags,
+                       const char *name)
+{
+  RWMutex *mutex = (RWMutex *) malloc (sizeof (RWMutex));
+  hythread_monitor_init_with_name (&mutex->syncMon, 0, (char *) name);
+  mutex->status = 0;
+  mutex->writer = 0;
+
+  ASSERT (handle);
+  *handle = mutex;
+
+  return 0;
+}
+
+/**
+ * Destroy a read/write mutex.
+ * 
+ * Destroying a mutex frees the internal resources associated
+ * with it.
+ *
+ * @note A mutex must NOT be destroyed if it is owned 
+ * by any threads for either read or write access.
+ *
+ * @param[in] mutex a mutex to be destroyed
+ * @return  0 on success or negative value on failure
+ * 
+ * @see hythread_rwmutex_init
+ */
+IDATA VMCALL
+hythread_rwmutex_destroy (hythread_rwmutex_t mutex)
+{
+  ASSERT (mutex);
+  ASSERT (mutex->syncMon);
+  ASSERT (0 == mutex->status);
+  ASSERT (0 == mutex->writer);
+  hythread_monitor_destroy (mutex->syncMon);
+  free (mutex);
+  return 0;
+}
+
+/**
+ * Enter a read/write mutex as a reader.
+ * 
+ * A thread may re-enter a mutex it owns multiple times, but
+ * must exit the same number of times as a reader 
+ * using hythread_rwmutex_exit_read.
+ * 
+ * A thread with writer access can enter a monitor
+ * with reader access, but must exit the mutex in the 
+ * opposite order. 
+ * 
+ * e.g. The following is acceptable
+ * hythread_rwmutex_enter_write(mutex);
+ * hythread_rwmutex_enter_read(mutex);
+ * hythread_rwmutex_exit_read(mutex);
+ * hythread_rwmutex_exit_write(mutex);
+ * 
+ * However, a thread with read access MUST NOT
+ * ask for write access on the same mutex. 
+ * 
+ * @param[in] mutex a mutex to be entered for read access
+ * @return 0 on success
+ * 
+ * @see hythread_rwmutex_exit_read
+ */
+IDATA VMCALL
+hythread_rwmutex_enter_read (hythread_rwmutex_t mutex)
+{
+  ASSERT_RWMUTEX (mutex);
+
+  if (mutex->writer == hythread_self ())
+    {
+      hythread_monitor_exit (mutex->syncMon);
+      return 0;
+    }
+
+  hythread_monitor_enter (mutex->syncMon);
+
+  while (mutex->status < 0)
+    {
+      hythread_monitor_wait (mutex->syncMon);
+    }
+  mutex->status++;
+
+  hythread_monitor_exit (mutex->syncMon);
+  return 0;
+
+}
+
+/**
+ * Exit a read/write mutex as a reader.
+ * 
+ * @param[in] mutex a mutex to be exited 
+ * @return 0 on success
+ * 
+ * @see hythread_rwmutex_enter_read
+ * 
+ */
+IDATA VMCALL
+hythread_rwmutex_exit_read (hythread_rwmutex_t mutex)
+{
+  ASSERT_RWMUTEX (mon);
+
+  if (mutex->writer == hythread_self ())
+    {
+      return 0;
+    }
+
+  hythread_monitor_enter (mutex->syncMon);
+
+  mutex->status--;
+  if (0 == mutex->status)
+    {
+      hythread_monitor_notify (mutex->syncMon);
+    }
+
+  hythread_monitor_exit (mutex->syncMon);
+
+  return 0;
+
+}
+
+/**
+ * Enter a read/write mutex as a writer.
+ * 
+ * A thread may re-enter a mutex it owns multiple times, but
+ * must exit the same number of times as a writer 
+ * using hythread_rwmutex_exit_write.
+ * 
+ * A thread with writer access can enter a monitor
+ * with reader access, but must exit the mutex in the 
+ * opposite order. 
+ * 
+ * e.g. The following is acceptable
+ * hythread_rwmutex_enter_write(mutex);
+ * hythread_rwmutex_enter_read(mutex);
+ * hythread_rwmutex_exit_read(mutex);
+ * hythread_rwmutex_exit_write(mutex);
+ * 
+ * However, a thread with read access MUST NOT
+ * ask for write access on the same mutex. 
+ * 
+ * @param[in] mutex a mutex to be entered for read access
+ * @return 0 on success
+ * 
+ * @see hythread_rwmutex_exit_write
+ */
+IDATA VMCALL
+hythread_rwmutex_enter_write (hythread_rwmutex_t mutex)
+{
+
+  hythread_t self = hythread_self ();
+  ASSERT_RWMUTEX (mutex);
+
+  /* recursive? */
+  if (mutex->writer == self)
+    {
+      mutex->status--;
+      return 0;
+    }
+
+  hythread_monitor_enter (mutex->syncMon);
+
+  while (mutex->status != 0)
+    {
+      hythread_monitor_wait (mutex->syncMon);
+    }
+  mutex->status--;
+  mutex->writer = self;
+
+  ASSERT (RWMUTEX_STATUS_WRITING (mutex));
+
+  hythread_monitor_exit (mutex->syncMon);
+
+  return 0;
+
+}
+
+/**
+ * Exit a read/write mutex as a writer.
+ * 
+ * @param[in] mutex a mutex to be exited
+ * @return 0 on success
+ * 
+ * @see hythread_rwmutex_enter_write
+ * 
+ */
+IDATA VMCALL
+hythread_rwmutex_exit_write (hythread_rwmutex_t mutex)
+{
+  ASSERT_RWMUTEX (mon);
+
+  ASSERT (mutex->writer == hythread_self ());
+  ASSERT (RWMUTEX_STATUS_WRITING (mutex));
+  hythread_monitor_enter (mutex->syncMon);
+
+  mutex->status++;
+  if (0 == mutex->status)
+    {
+      mutex->writer = NULL;
+      hythread_monitor_notify_all (mutex->syncMon);
+    }
+
+  hythread_monitor_exit (mutex->syncMon);
+  return 0;
+
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrcreate.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrcreate.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrcreate.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrcreate.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,70 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "thrcreate.h"
+
+#include <stdio.h>              /* for printf */
+#include <stdlib.h>             /* for abort */
+#include <limits.h>             /* for PTHREAD_STACK_MIN */
+#if defined(LINUX)
+#include "linuxonexit.h"
+#endif
+
+#include "hythread.h"
+
+IDATA
+create_pthread (pthread_t * handle, UDATA stacksize, UDATA priority,
+                entrypoint_t entrypoint, void *entryarg)
+{
+  pthread_attr_t attr;
+  struct sched_param sched_param;
+  IDATA retCode;
+#if defined(LINUX)
+  static int linux_on_exit_hook_set = 0;
+#endif
+
+  if (pthread_attr_init (&attr) != 0)
+    return -1;
+
+  /* verify that there are no extra fields in sched_param! This should be optimized out by any half decent compiler */
+  if (sizeof (sched_param) != sizeof (sched_param.sched_priority))
+    {
+      printf ("Assertion failed %s:%d\n", __FILE__, __LINE__);
+      abort ();
+    }
+
+  sched_param.sched_priority = priority;
+  pthread_attr_setschedparam (&attr, &sched_param);
+
+/* Linux allocates 2MB if you ask for a stack smaller than STACK_MIN */
+#if defined(LINUX)
+  if (stacksize < PTHREAD_STACK_MIN)
+    stacksize = PTHREAD_STACK_MIN;
+#endif
+
+  pthread_attr_setstacksize (&attr, stacksize);
+
+  retCode = pthread_create (handle, &attr, entrypoint, entryarg);
+
+#if defined(LINUX)
+  if (!linux_on_exit_hook_set)
+    {
+      linux_set_on_exit_hook ();
+      linux_on_exit_hook_set = 1;
+    }
+#endif
+
+  return retCode;
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrcreate.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrcreate.h?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrcreate.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrcreate.h Wed Nov 30 21:29:27 2005
@@ -0,0 +1,24 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(thrcreate_h)
+#define thrcreate_h
+#include <pthread.h>
+#include "hycomp.h"
+typedef void *(*entrypoint_t) (void *);
+IDATA create_pthread
+PROTOTYPE ((pthread_t * handle, UDATA stacksize, UDATA priority,
+            entrypoint_t entrypoint, void *entryarg));
+#endif /* thrcreate_h */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrdsup.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrdsup.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrdsup.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrdsup.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,144 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <pthread.h>
+#include <stdlib.h>
+#include "hycomp.h"
+#include "hymutex.h"
+/* ostypes */
+
+typedef pthread_t OSTHREAD;
+typedef pthread_key_t TLSKEY;
+typedef pthread_cond_t COND;
+#define WRAPPER_TYPE void*
+typedef void *WRAPPER_ARG;
+#define WRAPPER_RETURN() return NULL
+#if defined(LINUX)
+#include <semaphore.h>
+typedef sem_t OSSEMAPHORE;
+#else
+
+typedef IDATA OSSEMAPHORE;
+
+#endif
+
+#include "thrtypes.h"
+
+#if defined(LINUX) && defined(HYX86)
+#include <fpu_control.h>
+#endif
+
+#if !defined(HY_PRIORITY_MAP)
+extern void initialize_priority_map (void);
+#endif
+
+int linux_pthread_cond_timedwait
+PROTOTYPE ((pthread_cond_t * cond, pthread_mutex_t * mutex,
+            const struct timespec * abstime));
+IDATA VMCALL hythread_sigthreadmask_sigQuit PROTOTYPE ((void));
+IDATA init_thread_library PROTOTYPE ((void));
+IDATA VMCALL hythread_signalThread_sigQuit
+PROTOTYPE ((hythread_t sigQuitThread));
+IDATA VMCALL hythread_sigwait_sigQuit PROTOTYPE ((int *sig));
+IDATA nto_cond_init PROTOTYPE ((pthread_cond_t * cond));
+
+IDATA VMCALL sem_getvalue_zos PROTOTYPE ((hysem_t s));
+IDATA VMCALL sem_init_zos PROTOTYPE ((hysem_t s, int pShared, int initValue));
+IDATA VMCALL sem_trywait_aix PROTOTYPE ((hysem_t s));
+void call_hythread_init PROTOTYPE ((void));
+IDATA VMCALL sem_wait_zos PROTOTYPE ((hysem_t s));
+IDATA VMCALL sem_trywait_zos PROTOTYPE ((hysem_t s));
+IDATA VMCALL sem_wait_aix PROTOTYPE ((hysem_t s));
+IDATA VMCALL sem_init_aix PROTOTYPE ((hysem_t s, int pShared, int initValue));
+IDATA VMCALL sem_post_zos PROTOTYPE ((hysem_t s));
+IDATA VMCALL sem_post_aix PROTOTYPE ((hysem_t s));
+IDATA VMCALL sem_destroy_aix PROTOTYPE ((hysem_t s));
+
+void VMCALL hythread_init (struct HyThreadLibrary *lib);
+void VMCALL hythread_shutdown (void);
+
+struct HyThreadLibrary default_library;
+
+pthread_once_t init_once = PTHREAD_ONCE_INIT;
+
+void
+call_hythread_init (void)
+{
+  hythread_library_t lib = GLOBAL_DATA (default_library);
+
+#if !defined(HY_PRIORITY_MAP)
+  initialize_priority_map ();
+#endif
+
+  hythread_init (lib);
+}
+
+IDATA
+init_thread_library (void)
+{
+  hythread_library_t lib = GLOBAL_DATA (default_library);
+  pthread_once (&init_once, call_hythread_init);
+
+  return lib->initStatus != 1;
+}
+
+#if defined(LINUX) && defined(HYX86)
+int
+linux_pthread_cond_timedwait (pthread_cond_t * cond, pthread_mutex_t * mutex,
+                              const struct timespec *abstime)
+{
+  /* This is a wrapper around the pthread_cond_timedwait which restores the
+     fpu control word. The libpthread-0.9 version pthread_cond_timedwait on return resets the fpu control word to 0x37f
+   */
+
+  int rValue, oldCW;
+  _FPU_GETCW (oldCW);
+  rValue = pthread_cond_timedwait (cond, mutex, abstime);
+  oldCW &= 0xffff;
+  _FPU_SETCW (oldCW);
+  return rValue;
+}
+#endif
+
+#include <signal.h>
+/* waits for SIGQUIT to arrive
+	Used by the dedicated SIGQUIT handler thread
+*/
+IDATA VMCALL
+hythread_sigwait_sigQuit (int *sig)
+{
+
+  return 0;
+}
+
+/* Block all signals except SIGQUIT 
+	Used by the dedicated SIGQUIT handler thread
+*/
+IDATA VMCALL
+hythread_sigthreadmask_sigQuit (void)
+{
+
+  return 0;
+}
+
+/* 
+	Used to send a signal to a specific thread
+*/
+IDATA VMCALL
+hythread_signalThread_sigQuit (hythread_t sigQuitThread)
+{
+
+  return 0;
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrdsup.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrdsup.h?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrdsup.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrdsup.h Wed Nov 30 21:29:27 2005
@@ -0,0 +1,256 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(thrdsup_h)
+#define thrdsup_h
+#define HY_POSIX_THREADS
+#include <pthread.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <time.h>
+#include <errno.h>
+#include <setjmp.h>
+#include "hycomp.h"
+
+#if (defined(LINUX))
+#include <sys/time.h>
+#endif
+
+#include "hymutex.h"
+/* ostypes */
+typedef pthread_t OSTHREAD;
+typedef pthread_key_t TLSKEY;
+typedef pthread_cond_t COND;
+#define WRAPPER_TYPE void*
+typedef void *WRAPPER_ARG;
+#define WRAPPER_RETURN() return NULL
+#if defined(LINUX)
+#include <semaphore.h>
+typedef sem_t OSSEMAPHORE;
+#else
+
+typedef IDATA OSSEMAPHORE;
+
+#endif
+#include "thrtypes.h"
+#include "priority.h"
+#include "thrcreate.h"
+
+int linux_pthread_cond_timedwait
+PROTOTYPE ((pthread_cond_t * cond, pthread_mutex_t * mutex,
+            const struct timespec * abstime));
+IDATA VMCALL hythread_sigthreadmask_sigQuit PROTOTYPE ((void));
+IDATA init_thread_library PROTOTYPE ((void));
+IDATA VMCALL hythread_signalThread_sigQuit
+PROTOTYPE ((hythread_t sigQuitThread));
+IDATA VMCALL hythread_sigwait_sigQuit PROTOTYPE ((int *sig));
+IDATA nto_cond_init PROTOTYPE ((pthread_cond_t * cond));
+extern struct HyThreadLibrary default_library;
+/* priority_map */
+#if defined(HY_PRIORITY_MAP)
+extern const int priority_map[];
+#else
+extern int priority_map[];
+#endif
+
+/* SETUP_TIMEOUT */
+
+#define HYDIV_T div_t
+#define HYDIV div
+/* do we really need nanosecond clock accuracy even on platforms which support gettime? */
+
+#define TIMEOUT_CLOCK
+
+#if (defined(LINUX))
+#define SETUP_TIMEOUT(ts_, millis, nanos) {								\
+		struct timeval tv_;											\
+		HYDIV_T secs_ = HYDIV(millis, 1000);					\
+		int nanos_ = secs_.rem * 1000000 + nanos;				\
+		gettimeofday(&tv_, NULL);								\
+		nanos_ += tv_.tv_usec * 1000;						\
+		if (nanos_ >= 1000000000) {							\
+			ts_.tv_sec = tv_.tv_sec + secs_.quot + 1;		\
+			ts_.tv_nsec = nanos_ - 1000000000;			\
+		} else {														\
+			ts_.tv_sec = tv_.tv_sec + secs_.quot;			\
+			ts_.tv_nsec = nanos_;								\
+		} }
+#elif defined(HYOSE)
+#define SETUP_TIMEOUT(ts_, millis, nanos) { \
+		struct TimePair tvp; \
+		HYDIV_T secs_ = HYDIV(millis, 1000); \
+		int nanos_ = secs_.rem * 1000000 + nanos; \
+		rtc_get_time(&tvp); \
+		nanos_ += tvp.micros * 1000; \
+		if (nanos_ >= 1000000000) { \
+			ts_.tv_sec = tvp.seconds + secs_.quot + 1; \
+			ts_.tv_nsec = nanos_ - 1000000000; \
+		} else { \
+			ts_.tv_sec = tvp.seconds + secs_.quot; \
+			ts_.tv_nsec = nanos_; \
+		} }
+#else
+#define SETUP_TIMEOUT(ts_, millis, nanos) {								\
+		HYDIV_T secs_ = HYDIV(millis, 1000);					\
+		int nanos_ = secs_.rem * 1000000 + nanos;				\
+ 		clock_gettime(TIMEOUT_CLOCK, &ts_);		\
+		nanos_ += ts_.tv_nsec;									\
+		if (nanos_ >= 1000000000) {							\
+			ts_.tv_sec += secs_.quot + 1;						\
+			ts_.tv_nsec = nanos_ - 1000000000;			\
+		} else {														\
+			ts_.tv_sec += secs_.quot;							\
+			ts_.tv_nsec = nanos_;								\
+		} }
+#endif
+
+/* COND_DESTROY */
+#define COND_DESTROY(cond) pthread_cond_destroy(&(cond))
+
+/* TLS_GET */
+#define TLS_GET(key) (pthread_getspecific(key))
+
+/* TLS_ALLOC */
+#define TLS_ALLOC(key) (pthread_key_create(&key, NULL))
+
+/* TLS_SET */
+#define TLS_SET(key, value) (pthread_setspecific(key, value))
+
+/* COND_WAIT */
+/* NOTE: the calling thread must already own mutex */
+/* NOTE: a timeout less than zero indicates infinity */
+#define COND_WAIT(cond, mutex) \
+	do {	\
+		pthread_cond_wait(&(cond), &(mutex))
+#define COND_WAIT_LOOP()	} while(1)
+
+/* THREAD_SELF */
+#define THREAD_SELF() (pthread_self())
+
+/* THREAD_YIELD */
+#if defined(LINUX)
+#define THREAD_YIELD() (sched_yield())
+#endif
+
+#if defined(LINUX) && defined(HARDHAT)
+#undef THREAD_YIELD             /* undo the one defined above */
+#define THREAD_YIELD() (usleep(0))
+#endif
+
+/* last chance. If it's not defined by now, use yield */
+#if !defined(THREAD_YIELD)
+#define THREAD_YIELD() (yield())
+#endif
+
+/* THREAD_CREATE */
+#define THREAD_CREATE(thread, stacksize, priority, entrypoint, entryarg)	\
+	(create_pthread(&(thread)->handle, (stacksize), priority_map[(priority)], (entrypoint), (entryarg)) == 0)
+
+/* THREAD_CANCEL */
+/* pthread_cancel is asynchronous. Use join to wait for it to complete */
+#define THREAD_CANCEL(thread) (pthread_cancel(thread) || pthread_join(thread, NULL))
+
+/* COND_NOTIFY_ALL */
+#define COND_NOTIFY_ALL(cond) pthread_cond_broadcast(&(cond))
+
+/* COND_WAIT_IF_TIMEDOUT */
+/* NOTE: the calling thread must already own the mutex! */
+#if defined(LINUX) && defined(HYX86)
+#define PTHREAD_COND_TIMEDWAIT(x,y,z) linux_pthread_cond_timedwait(x,y,z)
+#else
+#define PTHREAD_COND_TIMEDWAIT(x,y,z) pthread_cond_timedwait(x,y,z)
+#endif
+
+#define COND_WAIT_RC_TIMEDOUT ETIMEDOUT
+
+#define COND_WAIT_IF_TIMEDOUT(cond, mutex, millis, nanos) 											\
+	do {																													\
+		struct timespec ts_;																							\
+		SETUP_TIMEOUT(ts_, millis, nanos);																						\
+		while (1) {																										\
+				if (PTHREAD_COND_TIMEDWAIT(&(cond), &(mutex), &ts_) == COND_WAIT_RC_TIMEDOUT)
+
+#define COND_WAIT_TIMED_LOOP()		}	} while(0)
+
+/* COND_INIT */
+#define COND_INIT(cond) (pthread_cond_init(&(cond), NULL) == 0)
+
+/* TLS_DESTROY */
+#define TLS_DESTROY(key) (pthread_key_delete(key))
+
+/* THREAD_EXIT */
+#define THREAD_EXIT() pthread_exit(NULL)
+
+/* THREAD_DETACH */
+#define THREAD_DETACH(thread) pthread_detach(thread)
+
+/* THREAD_SET_PRIORITY */
+#define THREAD_SET_PRIORITY(thread, priority) set_pthread_priority((thread), (priority))
+
+/* SEM_CREATE */
+#if defined(LINUX)
+#define SEM_CREATE(initValue) thread_malloc(NULL, sizeof(OSSEMAPHORE))
+#else
+#define SEM_CREATE(initValue)
+#endif
+
+/* SEM_INIT */
+#if defined(LINUX)
+#define SEM_INIT(sm, pshrd, inval)	(sem_init((sem_t*)sm, pshrd, inval))
+#else
+#define SEM_INIT(sm,pshrd,inval)
+#endif
+
+/* SEM_DESTROY */
+#if defined(LINUX)
+#define SEM_DESTROY(sm)	(sem_destroy((sem_t*)sm))
+#else
+#define SEM_DESTROY(sm)
+#endif
+
+/* SEM_FREE */
+#if defined(LINUX)
+#define	SEM_FREE(s)  	thread_free(NULL, (sem_t*)s);
+#endif
+
+/* SEM_POST */
+#if defined(LINUX)
+#define SEM_POST(smP)	(sem_post((sem_t*)smP))
+#else
+#define SEM_POST(sm)
+#endif
+
+/* SEM_WAIT */
+#if defined(LINUX)
+#define SEM_WAIT(smP)	(sem_wait((sem_t*)smP))
+#else
+#define SEM_WAIT(sm)
+#endif
+
+/* SEM_TRYWAIT */
+#if defined(LINUX)
+#define SEM_TRYWAIT(smP)	(sem_trywait(smP))
+#else
+#define SEM_TRYWAIT(sm)
+#endif
+
+/* SEM_GETVALUE */
+#if defined(LINUX)
+#define SEM_GETVALUE(smP, intP)	(sem_getvalue(smP, intP))
+#else
+#define SEM_GETVALUE(sm)
+#endif
+
+#endif /* thrdsup_h */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thread_copyright.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thread_copyright.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thread_copyright.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thread_copyright.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,19 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* A copyright string included in each DLL and executable */
+
+const char hyCopyright[] =
+  "(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.";

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/threaddef.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/threaddef.h?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/threaddef.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/threaddef.h Wed Nov 30 21:29:27 2005
@@ -0,0 +1,198 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(threaddef_h)
+#define threaddef_h
+#include <string.h>
+
+#include "thrdsup.h"
+#include "rasthrsup.h"
+#include "hythread.h"
+#undef hythread_monitor_init
+#undef hythread_monitor_init_with_name
+#include "thrtypes.h"
+#include "hypool.h"
+/*
+   Define this to force a thread to be spawned when
+   interrupting a waiting thread 
+	 (it's a debug thing)
+*/
+#undef ALWAYS_SPAWN_THREAD_TO_INTERRUPT
+/* You got to know what time it is */
+typedef U_64 hytime_t;
+typedef I_64 hytime_delta_t;
+/* ASSERT and Debug */
+#if !defined(STATIC_ASSERT)
+#define STATIC_ASSERT(x) do { typedef int failed_assert[(x) ? 1 : -1]; } while(0)
+#endif
+
+#if (definedTHREAD_ASSERTS)
+#define UNOWNED ((hythread_t)-1)
+extern hythread_t global_lock_owner;
+#undef NDEBUG
+#include <assert.h>
+#if !defined(ASSERT)
+#define ASSERT(x) assert((x))
+#endif
+
+#if !defined(ASSERT_DEBUG)
+#define ASSERT_DEBUG(x) assert((x))
+#endif
+#else
+#if !defined(ASSERT)
+#define ASSERT(ignore)       ((void)0)
+#endif
+
+#if !defined(ASSERT_DEBUG)
+#define ASSERT_DEBUG(ignore) ((void)0)
+#endif
+#endif
+#undef  DEBUG
+#define DEBUG (0)
+/* Helper defines for notify_thread() */
+#define SET_NOTIFIED_FLAG (1)
+#define DONT_SET_NOTIFIED_FLAG (0)
+void hythread_monitor_pin
+PROTOTYPE ((hythread_monitor_t monitor, hythread_t self));
+void hythread_monitor_unpin
+PROTOTYPE ((hythread_monitor_t monitor, hythread_t self));
+void paint_stack PROTOTYPE ((hythread_t thread));
+
+/*
+ * constants for profiling
+ */
+#define MAX_CALLER_INDEX 63   
+enum
+{
+  CALLER_ATTACH = 0,
+  CALLER_DESTROY,
+  CALLER_SUSPEND,
+  CALLER_RESUME,
+  CALLER_CLEAR_INTERRUPTED,
+  CALLER_THREAD_WRAPPER,
+  CALLER_NOTIFY_ONE_OR_ALL,
+  CALLER_SLEEP_INTERRUPTABLE,
+  CALLER_TRY_ENTER_USING,
+  CALLER_SLEEP,
+  CALLER_EXIT_MONITOR,
+  CALLER_DETACH,
+  CALLER_CLEAR_PRIORITY_INTERRUPTED,
+  CALLER_INTERNAL_EXIT1,
+  CALLER_INTERNAL_EXIT2,
+  CALLER_MONITOR_ENTER1,
+  CALLER_MONITOR_ENTER2,
+  CALLER_MONITOR_ENTER_THREE_TIER1,
+  CALLER_MONITOR_ENTER_THREE_TIER2,
+  CALLER_MONITOR_ENTER_THREE_TIER3,
+  CALLER_MONITOR_EXIT1,
+  CALLER_MONITOR_WAIT1,
+  CALLER_MONITOR_WAIT2,
+  CALLER_INTERRUPT_THREAD,
+  CALLER_MONITOR_NUM_WAITING,
+  CALLER_MONITOR_DESTROY,
+  CALLER_GLOBAL_LOCK,
+  CALLER_MONITOR_ACQUIRE,
+  CALLER_INTERRUPT_SERVER,
+  CALLER_RESET_TRACING,
+  CALLER_LIB_SET_FLAGS,
+  CALLER_LIB_CLEAR_FLAGS,
+  CALLER_PARK,
+  CALLER_UNPARK,
+  CALLER_LAST_INDEX
+};
+/* helper defines for local functions */
+#define WAIT_INTERRUPTABLE   (1)
+#define WAIT_UNINTERRUPTABLE (0)
+#define NOTIFY_ONE (0)
+#define NOTIFY_ALL (1)
+#define GLOBAL_NOT_LOCKED (0)
+#define GLOBAL_IS_LOCKED  (1)
+/* MACRO_SELF */
+#define MACRO_SELF() ((hythread_t)TLS_GET( ((hythread_library_t)GLOBAL_DATA(default_library))->self_ptr))
+/* GLOBAL_LOCK */
+#if defined(THREAD_ASSERTS)
+#define GLOBAL_LOCK(self,caller) { ASSERT(global_lock_owner != self); MUTEX_ENTER((self)->library->monitor_mutex); ASSERT(UNOWNED == global_lock_owner); global_lock_owner = self; }
+#else
+#define GLOBAL_LOCK(self, caller) MUTEX_ENTER(self->library->monitor_mutex)
+#endif
+/* GLOBAL_UNLOCK */
+#if defined(THREAD_ASSERTS)
+#define GLOBAL_UNLOCK(self) { ASSERT (self == global_lock_owner); global_lock_owner = UNOWNED; MUTEX_EXIT(self->library->monitor_mutex); }
+#else
+#define GLOBAL_UNLOCK(self) MUTEX_EXIT(self->library->monitor_mutex)
+#endif
+/*
+ * GLOBAL_LOCK_SIMPLE
+ * locking when you don't have a thread, just a lib
+ */
+#if defined(THREAD_ASSERTS)
+#define GLOBAL_LOCK_SIMPLE(lib) { hythread_t self = MACRO_SELF(); ASSERT (self != global_lock_owner); MUTEX_ENTER(lib->monitor_mutex); ASSERT(UNOWNED == global_lock_owner); global_lock_owner = self; }
+#else
+#define GLOBAL_LOCK_SIMPLE(lib) MUTEX_ENTER(lib->monitor_mutex)
+#endif
+/*
+ * GLOBAL_UNLOCK_SIMPLE
+ * unlocking when you don't have a thread, just a lib
+ */
+#if defined(THREAD_ASSERTS)
+#define GLOBAL_UNLOCK_SIMPLE(lib) { ASSERT (MACRO_SELF() == global_lock_owner); global_lock_owner = UNOWNED; MUTEX_EXIT(lib->monitor_mutex); }
+#else
+#define GLOBAL_UNLOCK_SIMPLE(lib) MUTEX_EXIT(lib->monitor_mutex)
+#endif
+/* THREAD_LOCK */
+#define THREAD_LOCK(self, thread, caller) MUTEX_ENTER(thread->mutex)
+/* THREAD_UNLOCK */
+#define THREAD_UNLOCK(self, thread) MUTEX_EXIT(thread->mutex)
+/* MONITOR_LOCK */
+#define MONITOR_LOCK(self, monitor, caller) MUTEX_ENTER(monitor->mutex)
+/* MONITOR_TRY_LOCK */
+#if defined(FORCE_TO_USE_IS_THREAD)
+/*
+ * Force the use of the interruptServer (IS) thread by always failing
+ * when trying to enter a monitor without blocking
+ */
+#define MONITOR_TRY_LOCK(monitor)  (-1)
+#else
+#define MONITOR_TRY_LOCK(monitor) (MUTEX_TRY_ENTER(monitor->mutex))
+#endif
+/* MONITOR_UNLOCK */
+#define MONITOR_UNLOCK(self, monitor) MUTEX_EXIT(monitor->mutex)
+/* IS_JLM_ENABLED */
+#define IS_JLM_ENABLED(thread) ((thread)->library->flags & HYTHREAD_FLAG_JLM_ENABLED)
+/* IS_JLM_TS_ENABLED */
+#define IS_JLM_TS_ENABLED(thread) ((thread)->library->flags & HYTHREAD_FLAG_JLMTS_ENABLED)
+/* IS_JLM_HST_ENABLED */
+#define IS_JLM_HST_ENABLED(thread) ((thread)->library->flags & HYTHREAD_FLAG_JLMHST_ENABLED)
+/* ACCUMULATE_SPIN_TIME */
+#define ACCUMULATE_SPIN_TIME(spinTime,    \
+		endSpinTime, startSpinTime,           \
+		endPauseSpinTime, startPauseSpinTime) \
+\
+	/* accumulate spin interval in monitor:                                                                     \
+	     - again delta could be negative if CPU clocks not sync, and thread has moved to another processor      \
+	     - also the spin start time will be zero if no spinning has occurred. This is a convention              \
+	*/                                                                                                          \
+	if ((startSpinTime) > 0) {                                                                                  \
+		/* must be declared as a local variable in the C function from which this is called */                    \
+		deltaTime = (TIME_DELTA) ((endSpinTime) - (startSpinTime));                                               \
+	                                                                                                            \
+		if (deltaTime > 0) {                                           													                  \
+			(spinTime) += (TIME) deltaTime;                                                                         \
+			deltaTime = (TIME_DELTA) ((endPauseSpinTime) - (startPauseSpinTime));                                   \
+			if ((spinTime) > deltaTime) {                                                                           \
+				(spinTime) -= deltaTime; /* assumes gc can't run once spinning on try_enter starts */                 \
+			}                                                                                                       \
+		}
+#endif /* threaddef_h */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrhelp.s
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrhelp.s?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrhelp.s (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrhelp.s Wed Nov 30 21:29:27 2005
@@ -0,0 +1,110 @@
+# $$COPYRIGHT$$[1991, 2005]$$
+
+eq_hy_null = 0
+eq_HyThreadMonitor_pinCount = 28
+eq_pointer_size = 4
+eqS_current_stack_depth = 16
+eqS_hythread_monitor_pin = 16
+eqS_hythread_monitor_unpin = 16
+eqSR_current_stack_depth = 4
+eqSR_hythread_monitor_pin = 4
+eqSR_hythread_monitor_unpin = 4
+eqSRS_current_stack_depth = 16
+eqSRS_hythread_monitor_pin = 16
+eqSRS_hythread_monitor_unpin = 16
+eqSS_current_stack_depth = 64
+eqSS_hythread_monitor_pin = 64
+eqSS_hythread_monitor_unpin = 64
+       	#CODE32 SEGMENT FLAT PUBLIC 'CODE'
+       	#assume cs:flat,ds:flat,ss:flat
+       	#CODE32 ends
+       	#CODE32 SEGMENT FLAT PUBLIC 'CODE'
+       	#assume cs:flat,ds:flat,ss:flat
+        .globl hythread_monitor_pin
+        .type hythread_monitor_pin,@function
+        .globl current_stack_depth
+        .type current_stack_depth,@function
+        .globl hythread_monitor_unpin
+        .type hythread_monitor_unpin,@function
+
+        .text
+        .align 4
+current_stack_depth:
+        push %ebp
+        mov %esp, %ebp
+        push %esi
+        push %edi
+        push %ebx
+        sub $64, %esp
+        movl %ebp, %ebx
+        jmp .L2
+.L1:
+        movl %ecx, %ebx
+.L2:
+        movl (%ebx), %ecx
+        testl %ecx, %ecx                         ## setFlags: true
+        jnz .L1
+        subl %ebp, %ebx
+        movl %ebx, %ecx
+        movl %ebx, %eax                          ## RegReg opt
+        add $64, %esp
+        pop %ebx
+        pop %edi
+        pop %esi
+        pop %ebp
+        ret
+END_current_stack_depth:
+        .size current_stack_depth,END_current_stack_depth - current_stack_depth
+
+## Prototype: void hythread_monitor_pin( hythread_monitor_t monitor, hythread_t osThread);
+## Defined in: #THREAD Args: 2
+
+        .text
+        .align 4
+hythread_monitor_pin:
+        push %ebp
+        mov %esp, %ebp
+        push %esi
+        push %edi
+        push %ebx
+        sub $64, %esp
+        movl (eqSRS_hythread_monitor_pin+0+8+eqSS_hythread_monitor_pin)(%esp), %ebx
+        movl (eqSRS_hythread_monitor_pin+0+4+eqSS_hythread_monitor_pin)(%esp), %ebx
+        lock 
+        incl eq_HyThreadMonitor_pinCount(%ebx)   ##  (Converted add 1 to inc)
+        add $64, %esp
+        pop %ebx
+        pop %edi
+        pop %esi
+        pop %ebp
+        ret
+END_hythread_monitor_pin:
+        .size hythread_monitor_pin,END_hythread_monitor_pin - hythread_monitor_pin
+
+## Prototype: void hythread_monitor_unpin( hythread_monitor_t monitor, hythread_t osThread);
+## Defined in: #THREAD Args: 2
+
+        .text
+        .align 4
+hythread_monitor_unpin:
+        push %ebp
+        mov %esp, %ebp
+        push %esi
+        push %edi
+        push %ebx
+        sub $64, %esp
+        movl (eqSS_hythread_monitor_unpin+0+8+eqSRS_hythread_monitor_unpin)(%esp), %ebx
+        movl (eqSS_hythread_monitor_unpin+0+eqSRS_hythread_monitor_unpin+4)(%esp), %ebx
+        lock 
+        decl eq_HyThreadMonitor_pinCount(%ebx)   ##  (Converted subtract 1 to dec)
+        add $64, %esp
+        pop %ebx
+        pop %edi
+        pop %esi
+        pop %ebp
+        ret
+END_hythread_monitor_unpin:
+        .size hythread_monitor_unpin,END_hythread_monitor_unpin - hythread_monitor_unpin
+
+       	#CODE32 ends
+        # end of file

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrprof.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrprof.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrprof.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrprof.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,330 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file
+ * @ingroup Thread
+ */
+
+
+/*
+ *	the following must come before the standard includes because thrdsup.h 
+ *	includes windows.h in Win32.
+ */
+#include "thrdsup.h"
+
+#include "hythread.h"
+#include "thrtypes.h"
+
+#define CDEV_CURRENT_FUNCTION _prototypes_private
+
+     void paint_stack PROTOTYPE ((hythread_t thread));
+
+#undef CDEV_CURRENT_FUNCTION
+
+     extern UDATA current_stack_depth PROTOTYPE ((void));
+
+#define STACK_PATTERN 0xBAADF00D
+
+#define CDEV_CURRENT_FUNCTION hythread_get_flags
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_get_cpu_time
+
+/**
+ * Return the amount of CPU time used by a thread.
+ * 
+ * @param[in] thread
+ * @return actual time on CPU used by thread (nanoseconds) or
+ * negative value if not supported.
+ * 
+ */
+     I_64 VMCALL hythread_get_cpu_time (hythread_t thread)
+{
+
+#if defined(WIN32)
+  FILETIME creationTime, exitTime, kernelTime, userTime;
+  I_64 totalTime;
+  /* WARNING! Not supported on Win95!  Need to test to ensure this fails gracefully */
+  if (GetThreadTimes
+      (thread->handle, &creationTime, &exitTime, &kernelTime, &userTime))
+    {
+      totalTime =
+        ((I_64) kernelTime.
+         dwLowDateTime | ((I_64) kernelTime.dwHighDateTime << 32)) +
+        ((I_64) userTime.
+         dwLowDateTime | ((I_64) userTime.dwHighDateTime << 32));
+      /* totalTime is in 100's of nanos.  Convert to nanos */
+      return totalTime * 100;
+    }
+#endif /* WIN32 */
+
+  return -1;
+
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_get_handle
+
+/** 
+ * Return the OS handle for a thread.
+ * 
+ * @param thread a thread
+ * @return OS handle
+ */
+UDATA VMCALL
+hythread_get_handle (hythread_t thread)
+{
+
+  return (UDATA) thread->handle;
+
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_enable_stack_usage
+
+/**
+ * Enable or disable monitoring of stack usage.
+ * 
+ * @param[in] enable 0 to disable or non-zero to enable.
+ * @return none
+ * 
+ */
+void VMCALL
+hythread_enable_stack_usage (UDATA enable)
+{
+  hythread_library_t lib = GLOBAL_DATA (default_library);
+  lib->stack_usage = enable;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_get_stack_usage
+
+/** 
+ * Return the approximate stack usage by a thread
+ * 
+ * @param[in] thread a thread 
+ * @return 0 if the stack has not been painted<br>
+ * (UDATA)-1 if the stack has overflowed<br>
+ *  otherwise the approximate maximum number of bytes used on the stack
+ * 
+ */
+UDATA VMCALL
+hythread_get_stack_usage (hythread_t thread)
+{
+#if defined(LINUX)
+  return 0;
+#else
+  UDATA *tos = thread->tos;
+  UDATA count = thread->stacksize;
+  if (tos == NULL || count == 0)
+    {
+      return 0;
+    }
+  if (*tos != STACK_PATTERN)
+    {
+      return (UDATA) - 1;
+    }
+  while (*tos++ == STACK_PATTERN)
+    {
+      count -= sizeof (UDATA);
+    }
+  return count;
+#endif
+
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION paint_stack
+
+/*
+ * Paint a thread's stack.
+ * 
+ * Attempt to paint the stack region with STACK_PATTERN so we can
+ * detect stack usage.  Sets thread->tos to the maximum stack
+ * address.
+ * @note This won't work on PA-RISC because of backwards stacks
+ * 
+ * @param thread a thread
+ * @return none
+ */
+void
+paint_stack (hythread_t thread)
+{
+
+#if defined(LINUX)
+  /* z/OS and Linux don't let us set the stack size, so we can't paint the stack safely */
+#elif defined (PILOT) || defined (PALMOS5)
+  UDATA *stack = (UDATA *) & stack;
+
+  SysAppInfoType *appInfo = SysCurAppInfoPV20 ();
+  thread->tos = (void *) appInfo->stackP;
+  thread->stacksize =
+    (U_8 *) appInfo->stackEndP - (U_8 *) appInfo->stackP + 1;
+/* don't paint the top 32 slots (to protect this stack frame) */
+  for (stack -= 32; stack > thread->tos; stack--)
+    {
+      *stack = STACK_PATTERN;
+    }
+#elif defined(HYWINCE) || defined(WIN32)
+  MEMORY_BASIC_INFORMATION memInfo;
+  SYSTEM_INFO sysInfo;
+  UDATA *curr;
+  UDATA *stack = (UDATA *) & stack;
+  /*      Find out where the stack starts. */
+  VirtualQuery (stack, &memInfo, sizeof (MEMORY_BASIC_INFORMATION));
+  /* Start painting. Skip the top 32 slots (to protect this stack frame) */
+  curr = stack - 32;
+  __try
+  {
+    while (curr > (UDATA *) memInfo.AllocationBase)
+      *curr-- = STACK_PATTERN;
+  }
+  __except (1)
+  {
+    /*  Ran off the end of the stack. Stop */
+  }
+  thread->tos = curr + 1;
+  /* Round up to the system page size. */
+  GetSystemInfo (&sysInfo);
+  thread->stacksize =
+    ((UDATA) stack - (UDATA) thread->tos +
+     sysInfo.dwPageSize) & ~(sysInfo.dwPageSize - 1);
+#else
+  IDATA maxStack, stackSize, index;
+  UDATA *stack = (UDATA *) & stack;
+  stackSize = thread->stacksize - current_stack_depth ();
+  maxStack = stackSize / sizeof (UDATA) - 32;
+  if (maxStack <= 0)
+    {
+      return;
+    }
+  thread->tos = stack - maxStack;
+  /* don't paint the top 32 slots (to protect this stack frame) */
+  for (index = 32; index <= maxStack; index++)
+    {
+      *(stack - index) = STACK_PATTERN;
+    }
+#endif
+
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_get_stack_size
+
+/**
+ * Returns a thread's stack size.
+ * 
+ * @param[in] thread a thread
+ * @return 0 if the thread is an attached thread
+ * or the initial size of the thread's stack,
+ * 
+ */
+UDATA VMCALL
+hythread_get_stack_size (hythread_t thread)
+{
+  return thread->stacksize;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_get_os_priority
+
+/**
+ * Return the OS's scheduling policy and priority for a thread.
+ *
+ * Query the OS to determine the actual priority of the specified thread.
+ * The priority and scheduling policy are stored in the pointers provided.
+ * On Windows the "policy" contains the thread's priority class.
+ * On POSIX systems it contains the scheduling policy
+ * On OS/2 no information is available.  0 is stored in both pointers.
+ *
+ * @param[in] thread a thread
+ * @param[in] policy pointer to location where policy will be stored (non-NULL)
+ * @param[in] priority pointer to location where priority will be stored (non-NULL)
+ * @return 0 on success or negative value on failure
+ * 
+ */
+IDATA VMCALL
+hythread_get_os_priority (hythread_t thread, IDATA * policy, IDATA * priority)
+{
+#if defined(HY_POSIX_THREADS)
+  struct sched_param sched_param;
+  int osPolicy, rc;
+  rc = pthread_getschedparam (thread->handle, &osPolicy, &sched_param);
+  if (rc)
+    return -1;
+  *priority = sched_param.sched_priority;
+  *policy = osPolicy;
+#else
+#if defined(WIN32)
+  *priority = GetThreadPriority (thread->handle);
+  if (*priority == THREAD_PRIORITY_ERROR_RETURN)
+    return -1;
+
+  *policy = GetPriorityClass (thread->handle);
+  if (*policy == 0)
+    return -1;
+#else
+
+#error Unknown platform
+
+#endif /* HY_POSIX_THREADS */
+#endif /* HYEPOC32 */
+
+  return 0;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hythread_get_user_time
+/**
+ * Return the amount of USER time used by a thread.
+ * 
+ * @param[in] thread
+ * @return actual time on USER used by thread (nanoseconds) or
+ * negative value if not supported.
+ * 
+ */
+I_64 VMCALL
+hythread_get_user_time (hythread_t thread)
+{
+
+#if defined(WIN32)
+  FILETIME creationTime, exitTime, kernelTime, userTime;
+  I_64 totalTime;
+  /* WARNING! Not supported on Win95!  Need to test to ensure this fails gracefully */
+  if (GetThreadTimes
+      (thread->handle, &creationTime, &exitTime, &kernelTime, &userTime))
+    {
+      totalTime =
+        ((I_64) userTime.
+         dwLowDateTime | ((I_64) userTime.dwHighDateTime << 32));
+      /* totalTime is in 100's of nanos.  Convert to nanos */
+      return totalTime * 100;
+    }
+#endif /* WIN32 */
+
+  return -1;
+
+}
+
+#undef CDEV_CURRENT_FUNCTION

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrspinlock.s
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrspinlock.s?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrspinlock.s (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrspinlock.s Wed Nov 30 21:29:27 2005
@@ -0,0 +1,119 @@
+# $$COPYRIGHT$$[1991, 2005]$$
+
+eq_HyThreadAbstractMonitor_spinCount1 = 48
+eq_HyThreadAbstractMonitor_spinCount2 = 52
+eq_HyThreadAbstractMonitor_spinCount3 = 56
+eq_HyThreadAbstractMonitor_spinlockState = 40
+eq_pointer_size = 4
+eqS_hythread_spinlock_acquire = 18
+eqS_hythread_spinlock_swapState = 16
+eqSR_hythread_spinlock_acquire = 4
+eqSR_hythread_spinlock_swapState = 4
+eqSRS_hythread_spinlock_acquire = 16
+eqSRS_hythread_spinlock_swapState = 16
+eqSS_hythread_spinlock_acquire = 72
+eqSS_hythread_spinlock_swapState = 64
+HYTHREAD_MONITOR_SPINLOCK_OWNED = 1
+HYTHREAD_MONITOR_SPINLOCK_UNOWNED = 0
+       	#CODE32 SEGMENT FLAT PUBLIC 'CODE'
+       	#assume cs:flat,ds:flat,ss:flat
+       	#CODE32 ends
+       	#CODE32 SEGMENT FLAT PUBLIC 'CODE'
+       	#assume cs:flat,ds:flat,ss:flat
+        .globl hythread_yield # an extern
+        .globl hythread_spinlock_acquire
+        .type hythread_spinlock_acquire,@function
+        .globl hythread_spinlock_swapState
+        .type hythread_spinlock_swapState,@function
+## Prototype: IDATA hythread_spinlock_acquire(hythread_t self, hythread_monitor_t monitor);
+## Defined in: #THREAD Args: 2
+
+        .text
+        .align 4
+hythread_spinlock_acquire:
+        push %ebp
+        mov %esp, %ebp
+        push %esi
+        push %edi
+        push %ebx
+        sub $72, %esp
+        movl (eqSS_hythread_spinlock_acquire+0+eqSRS_hythread_spinlock_acquire+8)(%esp), %edx
+        movl eq_HyThreadAbstractMonitor_spinCount3(%edx), %ecx
+.L2:
+        movl eq_HyThreadAbstractMonitor_spinCount2(%edx), %ebx
+.L3:
+## Try to cmpxchg 0 into the target field (-1 indicates free)
+        cmpl $HYTHREAD_MONITOR_SPINLOCK_UNOWNED, eq_HyThreadAbstractMonitor_spinlockState(%edx) ## setFlags: true
+        jne .L10
+        xor %eax, %eax
+        movl $HYTHREAD_MONITOR_SPINLOCK_OWNED, %esi
+        lock 
+        cmpxchgl %esi, eq_HyThreadAbstractMonitor_spinlockState(%edx)
+        testl %eax, %eax                         ## setFlags: true
+        jnz .L10
+        xor %ebx, %ebx
+        jmp .L1
+.L10:
+        .word 37107                              ## PAUSE
+## begin tight loop
+        movl eq_HyThreadAbstractMonitor_spinCount1(%edx), %eax
+.L11:
+## inside tight loop
+        decl %eax                                ## setFlags: true(Converted subtract 1 to dec)
+        jnz .L11
+## end tight loop
+        decl %ebx                                ## setFlags: true(Converted subtract 1 to dec)
+        jnz .L3
+        movl %ecx, 64(%esp)                      ## save VMtemp3_1_3_(HyThreadAbstractMonitor->spinCount3)
+        movl %edx, 68(%esp)                      ## save VMtemp3_1_2_(struct HyThreadAbstractMonitor*) in_HyVMThreadSpinlocks>>#hythread_spinlock_acquire
+        call hythread_yield
+        movl 64(%esp), %ecx                      ## load VMtemp3_1_3_(HyThreadAbstractMonitor->spinCount3)
+        decl %ecx                                ## setFlags: true(Converted subtract 1 to dec)
+        movl 68(%esp), %edx                      ## load VMtemp3_1_2_(struct HyThreadAbstractMonitor*) in_HyVMThreadSpinlocks>>#hythread_spinlock_acquire
+        jnz .L2
+        movl $-1, %ebx
+.L1:
+        movl %ebx, %eax
+        add $72, %esp
+        pop %ebx
+        pop %edi
+        pop %esi
+        pop %ebp
+        ret
+END_hythread_spinlock_acquire:
+        .size hythread_spinlock_acquire,END_hythread_spinlock_acquire - hythread_spinlock_acquire
+
+## Prototype: UDATA hythread_spinlock_swapState(hythread_monitor_t monitor, UDATA newState);
+## Defined in: #THREAD Args: 2
+
+        .text
+        .align 4
+hythread_spinlock_swapState:
+        push %ebp
+        mov %esp, %ebp
+        push %esi
+        push %edi
+        push %ebx
+        sub $64, %esp
+        movl (eqSS_hythread_spinlock_swapState+0+eqSRS_hythread_spinlock_swapState+4)(%esp), %ebx
+        movl (eqSS_hythread_spinlock_swapState+0+eqSRS_hythread_spinlock_swapState+8)(%esp), %ecx
+## If we are writing in UNOWNED, we are exiting the critical section, therefore
+## have to finish up any writes
+        testl %ecx, %ecx                         ## setFlags: true
+        ## memory barrier (no code necessary for write barriers)
+        xchgl %ecx, eq_HyThreadAbstractMonitor_spinlockState(%ebx)
+## if we entered the critical section, (i.e. we swapped out UNOWNED) then
+## we have to issue a readBarrier
+        testl %ecx, %ecx                         ## setFlags: true
+        movl %ecx, %eax
+        add $64, %esp
+        pop %ebx
+        pop %edi
+        pop %esi
+        pop %ebp
+        ret
+END_hythread_spinlock_swapState:
+        .size hythread_spinlock_swapState,END_hythread_spinlock_swapState - hythread_spinlock_swapState
+
+       	#CODE32 ends
+        # end of file

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrtypes.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrtypes.h?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrtypes.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/thread/thrtypes.h Wed Nov 30 21:29:27 2005
@@ -0,0 +1,119 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(THRTYPES_H)
+#define THRTYPES_H
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+#include "hythread.h"
+  typedef struct HyThread
+  {
+    struct HyThreadLibrary *library;
+    UDATA attachcount;
+    UDATA priority;
+    struct HyThreadMonitor *monitor;
+    struct HyThread *next;
+    void *tls[128];
+    hythread_entrypoint_t entrypoint;
+    void *entryarg;
+    UDATA flags;
+    UDATA tid;
+    struct HyThread *interrupter;
+    OSTHREAD handle;
+    COND condition;
+    MUTEX mutex;
+    UDATA stacksize;
+    UDATA *tos;
+    void *jumpBuffer;
+  } HyThread;
+#define HYSIZEOF_HyThread 576
+  typedef struct HyThreadMonitor
+  {
+    UDATA count;
+    struct HyThread *owner;
+    struct HyThread *waiting;
+    UDATA flags;
+    UDATA userData;
+    struct HyThreadMonitorTracing *tracing;
+    char *name;
+    UDATA pinCount;
+    UDATA antiDeflationCount;
+    UDATA proDeflationCount;
+    UDATA spinlockState;
+    UDATA lockingWord;
+    UDATA spinCount1;
+    UDATA spinCount2;
+    UDATA spinCount3;
+    struct HyThread *blocking;
+    MUTEX mutex;
+  } HyThreadMonitor;
+#define HYSIZEOF_HyThreadMonitor sizeof(HyThreadMonitor)
+  typedef struct HyThreadMonitorPool
+  {
+    struct HyThreadMonitorPool *next;
+    struct HyThreadMonitor *next_free;
+    struct HyThreadMonitor entries[64];
+  } HyThreadMonitorPool;
+#define MONITOR_POOL_SIZE  64
+#define HYSIZEOF_HyThreadMonitorPool 4360
+  typedef struct HyThreadGlobal
+  {
+    struct HyThreadGlobal *next;
+    char *name;
+    UDATA data;
+  } HyThreadGlobal;
+#define HYSIZEOF_HyThreadGlobal 12
+  typedef struct HyThreadLibrary
+  {
+    UDATA spinlock;
+    struct HyThreadMonitorPool *monitor_pool;
+    struct HyPool *thread_pool;
+    UDATA threadCount;
+    UDATA stack_usage;
+    IDATA initStatus;
+    UDATA flags;
+    struct HyThreadMonitorTracing *gc_lock_tracing;
+    struct HyThreadGlobal *globals;
+    struct HyPool *global_pool;
+    MUTEX global_mutex;
+    TLSKEY self_ptr;
+    MUTEX monitor_mutex;
+    MUTEX tls_mutex;
+    hythread_tls_finalizer_t tls_finalizers[128];
+    char *thread_weight;
+    struct HyPool *monitor_tracing_pool;
+    struct HyPool *thread_tracing_pool;
+  } HyThreadLibrary;
+#define HYTHREAD_LIB_FLAG_JLMHST_ENABLED  0x10000
+#define HYTHREAD_LIB_FLAG_JLM_ENABLED  0x4000
+#define HYTHREAD_LIB_FLAG_JLM_ENABLED_ALL  0x1C000
+#define HYTHREAD_LIB_FLAG_JLM_HAS_BEEN_ENABLED  0x20000
+#define HYTHREAD_LIB_FLAG_JLMTS_ENABLED  0x8000
+#define HYSIZEOF_HyThreadLibrary 580
+  typedef struct HySemaphore
+  {
+    OSSEMAPHORE sem;
+  } HySemaphore;
+#define HYSIZEOF_HySemaphore 4
+#define STACK_DEFAULT_SIZE  0x8000
+#define FREE_TAG ((UDATA)-1)
+  typedef struct HyThreadMonitorPool *hythread_monitor_pool_t;
+  typedef struct HyThreadLibrary *hythread_library_t;
+#if defined(__cplusplus)
+}
+#endif
+#endif                          /* THRTYPES_H */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/vmi/DoxygenSupport.txt
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/vmi/DoxygenSupport.txt?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/vmi/DoxygenSupport.txt (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/linux.IA32/vmi/DoxygenSupport.txt Wed Nov 30 21:29:27 2005
@@ -0,0 +1,34 @@
+# Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+/*
+ * This file provides the group definitions required to create the Doxygen generated
+ * output for compounds.  There is one group per directory (port, pool, thread, etc.).
+ */
+ 
+/**
+ * @defgroup VMInterface VM Interface
+ * @brief The C VM Interface between \ref HarmonyNatives "Harmony natives" and the Java VM.
+ *
+ * The VM Interface must be implemented by the JVM vendor to support the \ref HarmonyNatives "Harmony natives".
+ * The VM vendor must export the following <a href='vmi_8h.html#VMIExports'>functions</a> from 
+ * the VM-Interface shared library.  The JVM vendor is free to add additional exports to this
+ * library for initialization purposes.
+ *
+ * The current implementation contains several temporary <a href='vmi_8h.html#VMITemporary'>functions</a>
+ * that will be removed in an upcoming revision.  The implementation of these temporary functions
+ * is trivial and described in the individual function comments. 
+ */
+
+



Mime
View raw message