[ECOS] Problem spawning a thread in Ecos

Nikhil R. nikhil_r@mindtree.com
Wed Jan 15 12:59:00 GMT 2003

Hi all,

We have a problem spawning a thread in Ecos using Uitron calls.
We have created our own package to run on ecos. We r also using the Uitron
compatibility package. From the constuctor of our package we make a call to
cre_tsk. The call fails. However when we make the call to cre_tsk from an
application (written on top of our eCos) using the same task id the call
succeeds. Here is a snapshot of the function (mt_mnet_init) called from the
pkg constructor.

void* mt_init(void* param)
   diag_printf("In mt_init\n");
   return NULL;

 * This function is invoked by constructor of the mnet_class
 * instance. This class is defined in ecos/init.cxx.
 * when the stack is brought up. This function spawns a IPv6
 * background thread.

void mt_mnet_init(void)
   ID tid = 13;
   T_CTSK thread_attr;
   int retval;

   static int _init = false;

   if(_init) return;

   mt_do_mnet_init(); // Blank function

   printf ( " Going to create task of %d\n", tid );
   thread_attr.exinf = 0;
   thread_attr.tskatr = TA_HLNG;
   thread_attr.itskpri = 8;
   thread_attr.stksz = 2048;
   thread_attr.task = (FP)mt_init;

   retval = cre_tsk(tid, &thread_attr);

   if(retval != E_OK)
       printf("###### The Thread Create API failed %d \n",retval);
       printf(" Thread create successful!!! \n");
   _init = true;


Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

More information about the Ecos-discuss mailing list