sittner / linuxcnc-ethercat

LinuxCNC EtherCAT HAL driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible bug: rtapi_mutex_get instead of rtapi_mutex_try ?

sirop opened this issue · comments

If I understand these lines correctly

'rtapi_mutex_get()' gets the mutex pointed to by 'mutex',
blocking if the mutex is not available. Because of this,
calling it from a realtime task is a "very bad" thing to
do.

https://github.com/machinekit/machinekit/blob/9e5dedd360fddd31cb8963a714f7297519c6bd4e/src/rtapi/rtapi.h#L405-L409
then the cyclic tasks void lcec_read_master(void *arg, long period) and void lcec_write_master(void *arg, long period) may not give a mutex if the cycle time is not properly estimated and therefore exceeds the servo thread period?

int rtapi_mutex_try(unsigned long *mutex) as a workaround?