Mercurial > dwindows
comparison os2/dw.c @ 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 | 86ace55df07b |
comparison
equal
deleted
inserted
replaced
1780:d1f65efea6b1 | 1781:a532ca0231ad |
---|---|
11621 * data: Parameter(s) passed to the function. | 11621 * data: Parameter(s) passed to the function. |
11622 * stack: Stack size of new thread (OS/2 and Windows only). | 11622 * stack: Stack size of new thread (OS/2 and Windows only). |
11623 */ | 11623 */ |
11624 DWTID API dw_thread_new(void *func, void *data, int stack) | 11624 DWTID API dw_thread_new(void *func, void *data, int stack) |
11625 { | 11625 { |
11626 void **tmp = malloc(sizeof(void *) * 2); | 11626 void **tmp = malloc(sizeof(void *) * 2); |
11627 | 11627 int z = 1; |
11628 tmp[0] = func; | 11628 |
11629 tmp[1] = data; | 11629 /* Clamp the stack size to 4K blocks... |
11630 | 11630 * since some CRTs require it (VAC) |
11631 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp); | 11631 */ |
11632 while(stack > (4096*z)) | |
11633 z++; | |
11634 | |
11635 tmp[0] = func; | |
11636 tmp[1] = data; | |
11637 | |
11638 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, (z*4096), (void *)tmp); | |
11632 } | 11639 } |
11633 | 11640 |
11634 /* | 11641 /* |
11635 * Ends execution of current thread immediately. | 11642 * Ends execution of current thread immediately. |
11636 */ | 11643 */ |