Skip to content

Commit

Permalink
Fix typo and restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
andreilitvin committed Aug 1, 2023
1 parent 91d4722 commit 0c1a1ea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
5 changes: 3 additions & 2 deletions src/controller/python/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ config("controller_wno_deprecate") {
declare_args() {
chip_python_version = "0.0"
chip_python_package_prefix = "chip"
chip_python_supports_stack_locking = (current_os != "mac") || (current_os != "ios")
chip_python_supports_stack_locking =
current_os != "mac" && current_os != "ios"
}

shared_library("ChipDeviceCtrl") {
Expand Down Expand Up @@ -78,8 +79,8 @@ shared_library("ChipDeviceCtrl") {
"chip/internal/ChipThreadWork.h",
"chip/internal/CommissionerImpl.cpp",
"chip/logging/LoggingRedirect.cpp",
"chip/native/PyChipError.cpp",
"chip/native/ChipMainLoopWork.h",
"chip/native/PyChipError.cpp",
"chip/tracing/TracingSetup.cpp",
"chip/utils/DeviceProxyUtils.cpp",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
#include "ChipMainLoopWork.h"

#include <platform/PlatformManager.h>
#include <platform/PlatformManager.h>

namespace chip {
namespace MainLoopWork {
Expand All @@ -27,14 +27,15 @@ using chip::DeviceLayer::PlatformMgr;

class ScopedStackLock
{
public:
public:
ScopedStackLock() { PlatformMgr().LockChipStack(); }
~ScopedStackLock() { PlatformMgr().UnlockChipStack(); }
};

} // namespace
} // namespace

void ExecuteInMainLoop(std::function<void()> f) {
void ExecuteInMainLoop(std::function<void()> f)
{
ScopedStackLock lock;
f();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,27 @@ void PerformWork(intptr_t arg)
work->Post();
}

} // namespace

} // namespace

void ExecuteInMainLoop(std::function<void()> f) {
void ExecuteInMainLoop(std::function<void()> f)
{

#if CHIP_STACK_LOCK_TRACKING_ENABLED
if (chip::DeviceLayer::PlatformMgr().IsChipStackLockedByCurrentThread()) {
if (chip::DeviceLayer::PlatformMgr().IsChipStackLockedByCurrentThread())
{
f();
return;
}
#endif

#if defined(__APPLE__)
if (chip::DeviceLayer::PlatformManagerImpl()::IsWorkQueueCurrentQueue()) {
if (chip::DeviceLayer::PlatformManagerImpl()::IsWorkQueueCurrentQueue())
{
f();
return;
}
#endif


// NOTE: the code below assumes that chip main loop is running.
// if it does not, this will deadlock.
//
Expand Down

0 comments on commit 0c1a1ea

Please sign in to comment.