Skip to content

Commit 562dfa3

Browse files
committed
Replace scheduleWork with scheduleLambda
1 parent 2f8e000 commit 562dfa3

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/platform/Tizen/DnssdImpl.cpp

+7-15
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <platform/CHIPDeviceConfig.h>
4141
#include <platform/GLibTypeDeleter.h>
4242
#include <platform/PlatformManager.h>
43+
#include <platform/CHIPDeviceLayer.h>
4344

4445
#include "ErrorUtils.h"
4546

@@ -276,20 +277,6 @@ void GetTextEntries(unsigned short txtLen, uint8_t * txtRecord, std::vector<chip
276277
}
277278
}
278279

279-
static void HandleResolveTask(intptr_t context)
280-
{
281-
ChipLogProgress(DeviceLayer, "DNSsd %s", __func__);
282-
auto rCtx = reinterpret_cast<chip::Dnssd::ResolveContext *>(context);
283-
if (!rCtx)
284-
{
285-
ChipLogError(DeviceLayer, "Null context in HandleResolveTask");
286-
return;
287-
}
288-
289-
rCtx->Finalize(CHIP_NO_ERROR);
290-
rCtx->mInstance->RemoveContext(rCtx);
291-
}
292-
293280
void OnResolve(dnssd_error_e result, dnssd_service_h service, void * userData)
294281
{
295282
ChipLogProgress(DeviceLayer, "DNSsd %s", __func__);
@@ -355,7 +342,12 @@ void OnResolve(dnssd_error_e result, dnssd_service_h service, void * userData)
355342

356343
rCtx->mResult.mAddress.emplace(ipAddr);
357344

358-
err = chip::DeviceLayer::PlatformMgr().ScheduleWork(HandleResolveTask, reinterpret_cast<intptr_t>(rCtx));
345+
err = chip::DeviceLayer::SystemLayer().ScheduleLambda([rCtx] {
346+
ChipLogProgress(DeviceLayer, "DNSsd Handle resolve task on schedule lambda");
347+
348+
rCtx->Finalize(CHIP_NO_ERROR);
349+
rCtx->mInstance->RemoveContext(rCtx);
350+
});
359351
VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "Failed to schedule resolve task: %s", err.AsString()));
360352

361353
return;

0 commit comments

Comments
 (0)