Ecos
1 intGx_thread_create (Const Char*thread_name, gx_thread_id *thread_id,2 void(*entry_func) (void*),void*Arg,3 void*Stack_base,4UnsignedintStack_size,5UnsignedintPriority ,6Gx_thread_info *thread_info)7 {8 #defineGx_thread_priority_max 2559 Ten if(Priority > Gx_thread_priority_max | | thread_id = =NULL One|| Entry_func = = NULL | | Thread_name = =NULL A|| Stack_base = = NULL | | Thread_info = =NULL) - return-1; - theCYG_THREAD_CREATE_EX (cyg_addrword_t) Priority, (cyg_thread_entry_t *) Entry_func, (cyg_addrword_t) ARG, -(Char*) Thread_name, stack_base, (cyg_ucount32) stack_size, thread_id, Thread_info,0); - -Cyg_thread_resume (*thread_id); + - return 0; +}
Linux:
1 intGx_thread_create (Const Char*thread_name, gx_thread_id *thread_id,2 void(*entry_func) (void*),void*Arg,3 void*Stack_base,4UnsignedintStack_size,5UnsignedintPriority ,6Gx_thread_info *thread_info)7 {8 structTask_struct *task =NULL;9 TenTask = Kthread_create ((int(*) (void*)) Entry_func, ARG,"%s", thread_name); One if(Task = =NULL) A return-1; - -GXAV_DBG ("%s (), Task:%p\n", __func__,task); the -*thread_id = (unsignedint) task; - -GXAV_DBG ("%s (), thread_id:0x%x\n", __func__,*thread_id); + - wake_up_process (Task); + A return 0; at}
Aa
Comparison of Linux and Ecos kernel thread creation/semaphore/event