changeset 1781:a532ca0231ad

Attempt at fixing the issue noted in the last commit. Seems the issue is stack related using VAC3.6... We are supposed to allocate the stack in 4K blocks on OS/2, so clamp the requested amount to a multiple of 4K that is at least as big as the amount requested.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 19 Jul 2012 19:46:35 +0000
parents d1f65efea6b1
children d056a50196a9
files os2/dw.c
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/os2/dw.c	Thu Jul 19 09:25:13 2012 +0000
+++ b/os2/dw.c	Thu Jul 19 19:46:35 2012 +0000
@@ -11623,12 +11623,19 @@
  */
 DWTID API dw_thread_new(void *func, void *data, int stack)
 {
-   void **tmp = malloc(sizeof(void *) * 2);
-
-   tmp[0] = func;
-   tmp[1] = data;
-
-   return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp);
+    void **tmp = malloc(sizeof(void *) * 2);
+    int z = 1;
+
+    /* Clamp the stack size to 4K blocks...
+     * since some CRTs require it (VAC)
+     */
+    while(stack > (4096*z))
+        z++;
+
+    tmp[0] = func;
+    tmp[1] = data;
+
+    return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, (z*4096), (void *)tmp);
 }
 
 /*