btashton edited a comment on issue #2663: URL: https://github.com/apache/incubator-nuttx/issues/2663#issuecomment-757421045
The issue with using a worker thread for what you have is that you have a while loop that waits on a semaphore https://github.com/MTres19/incubator-nuttx/blob/b63c54bb52f4158c6495723359032668f0947080/arch/arm/src/tiva/common/tiva_can.c#L731 This is a great place to use a a worker thread. Right here you currently are signalling your kernel thread to do work, instead you can schedule work and the work function itself will not wait and deadlock the the work queue. https://github.com/MTres19/incubator-nuttx/blob/b63c54bb52f4158c6495723359032668f0947080/arch/arm/src/tiva/common/tiva_can.c#L1791 ``` work_queue(HPWORK, &priv->cbwork, (worker_t)priv->callback, priv->cbarg, 0); ``` Note that the arg is stored in the device structure. This is one issue with what you are doing right now with your kernel thread, you are passing arguments that are allocated on the stack so they do not have have the proper lifecycle for the thread. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
