mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-20 11:23:06 +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) {
|
||||
(void)Lock::deinit(_subnode_mutex);
|
||||
}
|
||||
|
||||
_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);
|
||||
|
||||
if (rv < 0) {
|
||||
warnx("pthread_create() failed: %d", errno);
|
||||
rv = -errno;
|
||||
if (rv != 0) {
|
||||
rv = -rv;
|
||||
warnx("pthread_create() failed: %d", rv);
|
||||
delete _instance;
|
||||
_instance = nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user