mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
Bugfix:pthread_create retuns 0 on success and positive error on error without errono set
This commit is contained in:
@@ -98,6 +98,7 @@ UavcanServers::~UavcanServers()
|
|||||||
if (_mutex_inited) {
|
if (_mutex_inited) {
|
||||||
(void)Lock::deinit(_subnode_mutex);
|
(void)Lock::deinit(_subnode_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
_main_node.getDispatcher().removeRxFrameListener();
|
_main_node.getDispatcher().removeRxFrameListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,9 +165,9 @@ int UavcanServers::start(uavcan::INode &main_node)
|
|||||||
|
|
||||||
rv = pthread_create(&_instance->_subnode_thread, &tattr, static_cast<pthread_startroutine_t>(run_trampoline), NULL);
|
rv = pthread_create(&_instance->_subnode_thread, &tattr, static_cast<pthread_startroutine_t>(run_trampoline), NULL);
|
||||||
|
|
||||||
if (rv < 0) {
|
if (rv != 0) {
|
||||||
warnx("pthread_create() failed: %d", errno);
|
rv = -rv;
|
||||||
rv = -errno;
|
warnx("pthread_create() failed: %d", rv);
|
||||||
delete _instance;
|
delete _instance;
|
||||||
_instance = nullptr;
|
_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user