PT_SPAWN problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PT_SPAWN problem

563 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lumos on Wed Nov 21 06:34:08 MST 2012
Hello, I would like to describe my problem with PT_SPAWN macro in my project.
I am using PT_SPAWN macro to schedule child protothread and within this child protothread is used PT_YIELD macro. Such using of PT_YIELD macro leads to situation, that parent protothread does not wait for complete execution of child protothread, but continues after first occurence of PT_YIELD.

This is caused by calling of PT_SCHEDULE macro inside and this macro is defined as ((f) == PT_WAITING). It means parent protothread is waiting while child protothread is returning PT_WAITING. But if PT_YIELDED is returned, parent protothread continue. This is not correct, because child protothread was yielded only, not finished.

Is my understanding wrong? How this problem can be solved?
Thank you
0 Kudos
4 Replies

469 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lumos on Mon Dec 03 08:11:41 MST 2012
I solved this problem (until another solution will be available) by changing of PT_YIELD macro return value. I replaced PT_YIELDED reurn value by PT_WAITING return value. In this case everything is running well, but there is no possibility to distinguish from outside if protothread was yielded or is waiting. But in my case, it is not problem, because I do not check such case.
0 Kudos

469 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lumos on Thu Nov 22 00:55:26 MST 2012
No, I am not using FreeRTOS, I am using pt.h "library" only from uIP exaple for LPC1769. This can be general problem of the protothreads using.
0 Kudos

469 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Thu Nov 22 00:42:28 MST 2012
I think you are asking about FreeRTOS - try asking the questoin on hr FreeRTOS forum.
0 Kudos

469 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lumos on Wed Nov 21 23:46:42 MST 2012
Really no one have such problem?
Or should I be more specific and explain it in more details?
0 Kudos