Skip to content

Commit

Permalink
move RunOnMatterContext to LayerFreeRTOS
Browse files Browse the repository at this point in the history
  • Loading branch information
wqx6 committed Jan 7, 2025
1 parent 7ecbf7b commit ead181f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/inet/TCPEndPointImplLwIP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,9 @@ err_t TCPEndPointImplLwIP::LwIPHandleIncomingConnection(void * arg, struct tcp_p

if (arg != nullptr)
{
TCPEndPointImplLwIP * listenEP = static_cast<TCPEndPointImplLwIP *>(arg);
TCPEndPointImplLwIP * conEP = nullptr;
System::Layer & lSystemLayer = listenEP->GetSystemLayer();
TCPEndPointImplLwIP * listenEP = static_cast<TCPEndPointImplLwIP *>(arg);
TCPEndPointImplLwIP * conEP = nullptr;
System::LayerFreeRTOS & lSystemLayer = static_cast<System::LayerFreeRTOS &>(istenEP->GetSystemLayer());

// Tell LwIP we've accepted the connection so it can decrement the listen PCB's pending_accepts counter.
tcp_accepted(listenEP->mTCP);
Expand Down
4 changes: 3 additions & 1 deletion src/system/SystemLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ CHIP_ERROR Layer::ScheduleLambdaBridge(LambdaBridge && bridge)
return lReturn;
}

CHIP_ERROR Layer::RunOnMatterContext(std::function<CHIP_ERROR()> func)
#if CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT
CHIP_ERROR LayerFreeRTOS::RunOnMatterContext(std::function<CHIP_ERROR()> func)
{
CHIP_ERROR err = CHIP_NO_ERROR;
PlatformEventing::LockMatterStack(*this);
err = func();
PlatformEventing::UnlockMatterStack(*this);
return err;
}
#endif // CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT

} // namespace System
} // namespace chip
3 changes: 1 addition & 2 deletions src/system/SystemLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ class DLL_EXPORT Layer
return ScheduleLambdaBridge(std::move(bridge));
}

CHIP_ERROR RunOnMatterContext(std::function<CHIP_ERROR()>);

private:
CHIP_ERROR ScheduleLambdaBridge(LambdaBridge && bridge);

Expand All @@ -234,6 +232,7 @@ class DLL_EXPORT Layer

class LayerFreeRTOS : public Layer
{
CHIP_ERROR RunOnMatterContext(std::function<CHIP_ERROR()>);
};

#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
Expand Down

0 comments on commit ead181f

Please sign in to comment.