sys_thread_new vs. xTaskCreate

manug wrote on Wednesday, November 21, 2012:

Hello everybody,

I am new to FreeRtos and i have managed to create several tasks and do some task handling,. Then i started to get an lwIP example running with freertos. During my tentetive steps with freeRtos i created tasks wth xTaskCreate() and this worked well for me, also this is the way documented in the freeRTOSReferenceManual. But in the lwIP example, the tasks are created by using sys_thread_new.

Can somebody explain the differences between  the two functions? Are there advantages/disadvantages using the one or another?

manug wrote on Wednesday, November 21, 2012:

reading the documentation could help a lot…. :slight_smile:

If threads are supported by the underlying operating system and if
such functionality is needed in lwIP, the following function will have
to be implemented as well:

- sys_thread_t sys_thread_new(char *name, void (* thread)(void *arg), void *arg, int stacksize, int prio)

  Starts a new thread named “name” with priority “prio” that will begin its
  execution in the function “thread()”. The “arg” argument will be passed as an
  argument to the thread() function. The stack size to used for this thread is
  the “stacksize” parameter. The id of the new thread is returned. Both the id
  and the priority are system dependent.