You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/11/24 12:57:48 UTC

svn commit: r478843 - in /harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread: linux/hythread.c linux/makefile shared/hythread.c windows/hythread.c windows/makefile

Author: tellison
Date: Fri Nov 24 03:57:47 2006
New Revision: 478843

URL: http://svn.apache.org/viewvc?view=rev&rev=478843
Log:
Combine hythread files into shared code to reduce duplication.

Added:
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/shared/hythread.c
      - copied, changed from r478841, harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/linux/hythread.c
Removed:
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/linux/hythread.c
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/windows/hythread.c
Modified:
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/linux/makefile
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/windows/makefile

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/linux/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/linux/makefile?view=diff&rev=478843&r1=478842&r2=478843
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/linux/makefile (original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/linux/makefile Fri Nov 24 03:57:47 2006
@@ -22,9 +22,9 @@
 CFLAGS += -fpic
 
 BUILDFILES = \
-	$(SHAREDSUB)thread_copyright.o $(HY_ARCH)/thrhelp.o $(HY_ARCH)/thrspinlock.o hythread.o \
-	$(SHAREDSUB)hythreadinspect.o linuxonexit.o priority.o rasthrsup.o \
-	$(SHAREDSUB)rwmutex.o thrcreate.o thrdsup.o $(SHAREDSUB)thrprof.o
+	$(SHAREDSUB)thread_copyright.o $(HY_ARCH)/thrhelp.o $(HY_ARCH)/thrspinlock.o \
+	$(SHAREDSUB)hythread.o $(SHAREDSUB)hythreadinspect.o linuxonexit.o priority.o \
+	rasthrsup.o $(SHAREDSUB)rwmutex.o thrcreate.o thrdsup.o $(SHAREDSUB)thrprof.o
 
 SYSLIBFILES = -lpthread
 MDLLIBFILES = $(LIBPATH)libhypool.a $(LIBPATH)libhycommon.a

Copied: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/shared/hythread.c (from r478841, harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/linux/hythread.c)
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/shared/hythread.c?view=diff&rev=478843&p1=harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/linux/hythread.c&r1=478841&p2=harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/shared/hythread.c&r2=478843
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/linux/hythread.c (original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/shared/hythread.c Fri Nov 24 03:57:47 2006
@@ -3680,5 +3680,21 @@
 UDATA VMCALL
 hythread_current_stack_free(void)
 {
+#if defined(WIN32)
+  MEMORY_BASIC_INFORMATION memInfo;
+  SYSTEM_INFO sysInfo;
+  UDATA stackFree;
+  UDATA guardPageSize;
+
+  GetSystemInfo(&sysInfo);
+  VirtualQuery(&memInfo, &memInfo, sizeof(MEMORY_BASIC_INFORMATION));
+  stackFree = ((UDATA) &memInfo - (UDATA) memInfo.AllocationBase) & ~sizeof(UDATA);
+
+  /* By observation, Win32 reserves 3 pages at the low end of the stack for guard pages, so omit them */
+
+  guardPageSize = 3 * (UDATA) sysInfo.dwPageSize;
+  return (stackFree < guardPageSize) ? 0 : stackFree - guardPageSize;
+#else
   return 0;
+#endif
 }

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/windows/makefile?view=diff&rev=478843&r1=478842&r2=478843
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/windows/makefile (original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/windows/makefile Fri Nov 24 03:57:47 2006
@@ -24,7 +24,7 @@
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
 
 BUILDFILES = \
-  $(SHAREDSUB)thread_copyright.obj thrhelp.obj thrspinlock.obj hythread.obj \
+  $(SHAREDSUB)thread_copyright.obj thrhelp.obj thrspinlock.obj $(SHAREDSUB)hythread.obj \
   $(SHAREDSUB)hythreadinspect.obj $(SHAREDSUB)rwmutex.obj thrdsup.obj \
   $(SHAREDSUB)thrprof.obj