Skip to content

Commit

Permalink
Merge pull request #544 from Dronecode/remove-lock
Browse files Browse the repository at this point in the history
core: remove communication lock
  • Loading branch information
JonasVautherin committed Sep 17, 2018
2 parents 72badf0 + dedbedd commit 7f8209f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
18 changes: 0 additions & 18 deletions core/system_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ void SystemImpl::unregister_timeout_handler(const void *cookie)

void SystemImpl::process_mavlink_message(const mavlink_message_t &message)
{
if (_communication_locked) {
return;
}

_mavlink_handler_table_mutex.lock();

#if MESSAGE_DEBUGGING == 1
Expand Down Expand Up @@ -407,10 +403,6 @@ void SystemImpl::send_heartbeat()

bool SystemImpl::send_message(const mavlink_message_t &message)
{
if (_communication_locked) {
return false;
}

#if MESSAGE_DEBUGGING == 1
LogDebug() << "Sending msg " << size_t(message.msgid);
#endif
Expand Down Expand Up @@ -974,14 +966,4 @@ void SystemImpl::call_user_callback(const std::function<void()> &func)
_thread_pool.enqueue(func);
}

void SystemImpl::lock_communication()
{
_communication_locked = true;
}

void SystemImpl::unlock_communication()
{
_communication_locked = false;
}

} // namespace dronecode_sdk
8 changes: 0 additions & 8 deletions core/system_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,6 @@ class SystemImpl {
void register_plugin(PluginImplBase *plugin_impl);
void unregister_plugin(PluginImplBase *plugin_impl);

// This allows a plugin to lock and unlock all mavlink communication.
// The functionality is currently not used by a plugin included here
// but nevertheless there for other plugins that can be added from external.
void lock_communication();
void unlock_communication();

void call_user_callback(const std::function<void()> &func);

// Non-copyable
Expand Down Expand Up @@ -266,8 +260,6 @@ class SystemImpl {

Time _time{};

std::atomic<bool> _communication_locked{false};

std::mutex _plugin_impls_mutex{};
std::vector<PluginImplBase *> _plugin_impls{};

Expand Down

0 comments on commit 7f8209f

Please sign in to comment.