local fork (temporary)

Dependents:   VodafoneUSBModem_bleedingedge2

Fork of lwip-sys by mbed official

Revision:
5:5ca31173e0aa
Parent:
4:dd37867293e7
Child:
6:2ace1ff71ae6
--- a/arch/sys_arch.c	Fri Jul 06 08:55:22 2012 +0000
+++ b/arch/sys_arch.c	Mon Jul 16 14:46:19 2012 +0000
@@ -443,8 +443,12 @@
 #ifdef CMSIS_OS_RTX
     t->def.pthread = (os_pthread)thread;
     t->def.tpriority = (osPriority)priority;
-    t->def.instances = 1;
     t->def.stacksize = stacksize;
+    t->def.stack_pointer = (unsigned char*) malloc(stacksize); //Note DG: I don't think that malloc is always thread-safe, this could lead to memory corruption in some cases
+    if (t->def.stack_pointer == NULL)
+    {
+      error("Error allocating the stack memory");
+    }
 #endif
     t->id = osThreadCreate(&t->def, arg);
     if (t->id == NULL)