rtapi/xenomai: fix race condition on RT thread deletion
rtapi/xenomai: fix race condition on RT thread deletion

An rt_task_delete() does not make the thread go away immediately.

To assure the call returns only after the thread is actually terminated,
create threads with T_JOINABLE and rt_task_join() the thread on
RTAPI thread deletion.

this caused segfaults in RTAPI on shutdown, where the rtapi.so module
was already unloaded but the RT thread was not finished

Incidentially, this makes the USE_SIGXCPU support make work reliable.
I'll leave it turned off though - signal handlers in RT threads are
potentially fishy.

TODO: this fix should be ported to xenomai-kernel too

Cid427/machinekit,kinsamanka/machinekit,strahlex/machinekit,EqAfrica/machinekit,kinsamanka/machinekit,unseenlaser/machinekit,Cid427/machinekit,mhaberler/machinekit,cdsteinkuehler/MachineKit,araisrobo/machinekit,kinsamanka/machinekit,strahlex/machinekit,Cid427/machinekit,araisrobo/machinekit,bobvanderlinden/machinekit,cdsteinkuehler/MachineKit,RunningLight/machinekit,mhaberler/machinekit,strahlex/machinekit,Cid427/machinekit,cdsteinkuehler/linuxcnc,RunningLight/machinekit,bobvanderlinden/machinekit,ArcEye/MK-Qt5,cdsteinkuehler/linuxcnc,ArcEye/machinekit-testing,unseenlaser/machinekit,bobvanderlinden/machinekit,unseenlaser/machinekit,RunningLight/machinekit,RunningLight/machinekit,ArcEye/machinekit-testing,Cid427/machinekit,unseenlaser/machinekit,mhaberler/machinekit,mhaberler/machinekit,cdsteinkuehler/MachineKit,cdsteinkuehler/linuxcnc,EqAfrica/machinekit,kinsamanka/machinekit,cdsteinkuehler/linuxcnc,kinsamanka/machinekit,araisrobo/machinekit,ArcEye/MK-Qt5,araisrobo/machinekit,RunningLight/machinekit,araisrobo/machinekit,ArcEye/machinekit-testing,ArcEye/MK-Qt5,bobvanderlinden/machinekit,bobvanderlinden/machinekit,ArcEye/MK-Qt5,cdsteinkuehler/linuxcnc,araisrobo/machinekit,ArcEye/machinekit-testing,bobvanderlinden/machinekit,Cid427/machinekit,unseenlaser/machinekit,strahlex/machinekit,araisrobo/machinekit,EqAfrica/machinekit,bobvanderlinden/machinekit,EqAfrica/machinekit,strahlex/machinekit,mhaberler/machinekit,ArcEye/MK-Qt5,mhaberler/machinekit,cdsteinkuehler/MachineKit,Cid427/machinekit,unseenlaser/machinekit,EqAfrica/machinekit,cdsteinkuehler/linuxcnc,kinsamanka/machinekit,ArcEye/machinekit-testing,ArcEye/machinekit-testing,unseenlaser/machinekit,araisrobo/machinekit,ArcEye/MK-Qt5,RunningLight/machinekit,kinsamanka/machinekit,unseenlaser/machinekit,strahlex/machinekit,strahlex/machinekit,bobvanderlinden/machinekit,mhaberler/machinekit,cdsteinkuehler/MachineKit,RunningLight/machinekit,EqAfrica/machinekit,kinsamanka/machinekit,Cid427/machinekit,EqAfrica/machinekit,araisrobo/machinekit,ArcEye/machinekit-testing,mhaberler/machinekit,RunningLight/machinekit,ArcEye/MK-Qt5,cdsteinkuehler/MachineKit,ArcEye/MK-Qt5,EqAfrica/machinekit,ArcEye/machinekit-testing