Skip to content

Commit

Permalink
Update tizen code too
Browse files Browse the repository at this point in the history
  • Loading branch information
andreilitvin committed Sep 26, 2024
1 parent 44fa676 commit db933d5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/platform/Tizen/PlatformManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,21 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener
template <typename T>
CHIP_ERROR GLibMatterContextInvokeSync(CHIP_ERROR (*func)(T *), T * userData)
{
CHIP_ERROR LambdaErrorReturn;
struct
{
CHIP_ERROR returnValue = CHIP_NO_ERROR;
CHIP_ERROR (*functionToCall)(T *);
T * userData;
} context;

// wrapping the function pointer and userData into a Lambda, to be stored and passed as a LambdaBridge
auto lambda = [func, userData](CHIP_ERROR * apErrorReturn) { *apErrorReturn = func(userData); };
context.functionToCall = func;
context.userData = userData;

LambdaBridge bridge;
bridge.Initialize(lambda, &LambdaErrorReturn);
_GLibMatterContextInvokeSync(std::move(bridge));
bridge.Initialize([&context]() { context.returnValue = context.functionToCall(context.userData); });

return LambdaErrorReturn;
_GLibMatterContextInvokeSync(std::move(bridge));
return context.returnValue;
}
System::Clock::Timestamp GetStartTime() { return mStartTime; }

Expand Down

0 comments on commit db933d5

Please sign in to comment.