rtlabs-com / p-net

PROFINET device stack for embedded devices
http://www.rt-labs.com
Other
475 stars 194 forks source link

Linux init() -> deinit() #343

Open DominikDessArc opened 3 years ago

DominikDessArc commented 3 years ago

It might be necessary for our application to restart the driver from within the process without restarting the process. In the current version of the driver, there is no way to join the threads created by 'os_thread_t * os_thread_create' If, for example, I let unit tests using this driver run with --gtest_repeat=xxx, I will have 2 additional threads (1 for eth, 1 for SNMP) for every iteration. I would like to find a way to deinit() the driver without any dangling threads. I understand that not having deinit() is not really a problem for microcontrollers since it would never be needed.
Are there any plans in consideration to add a pnet_deinit() corresponding to pnet_init()? Am I maybe missing something? So far, I have not found an option that enables me to call pnet_init() again without spawning more and more threads. If there is anything that needs clarification, please let me know. (Development Environment is ubuntu18.04 x86 desktop). The target platform is ubuntu18.04 arm.

pyhys commented 3 years ago

Hi, thanks for your input. Yes, I think that we need to implement this in order to support more use cases. It has not yet been included in the planning, though.

Duplicate of #260