Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[AI Task] [Tizen.Network.WiFi] Add RunContinuationsAsynchronously to async TCS#7669

Open
JoonghyunCho wants to merge 1 commit into
main from
ai-task/issue-7620
Open

[AI Task] [Tizen.Network.WiFi] Add RunContinuationsAsynchronously to async TCS #7669
JoonghyunCho wants to merge 1 commit into
main from
ai-task/issue-7620

Conversation

@JoonghyunCho

@JoonghyunCho JoonghyunCho commented May 31, 2026

Copy link
Copy Markdown
Member

Summary

Add TaskCreationOptions.RunContinuationsAsynchronously to all 13 TaskCompletionSource construction sites in Tizen.Network.WiFi so that awaiter continuations no longer execute inline on the native callback thread.

Changes

  • src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs — 8 sites (ActivateAsync, ActivateWithWiFiPickerTestedAsync, DeactivateAsync, ScanAsync, ScanSpecificAPAsync, BssidScanAsync, HiddenAPConnectAsync, StartMultiScan).
  • src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAP.cs — 5 sites (ConnectAsync, ConnectWpsAsync, ConnectWpsWithoutSsidAsync, DisconnectAsync, ForgetAPAsync).

The only change per site is passing TaskCreationOptions.RunContinuationsAsynchronously to the TaskCompletionSource constructor. No signature changes, no behavior change apart from where continuations run.

Mode

Refactoring

Verification

  • Build: passed (dotnet build on src/Tizen.Network.WiFi, 0 errors)
  • Tests: N/A (no unit tests for this internal async path in the repo)
  • Benchmark: skipped (no sdb device available in this run; manual verification recommended on target)

Fixes #7620

gemini-code-assist[bot] reacted with eyes emoji
Every TaskCompletionSource in the WiFi async path is completed from a
native callback thread. Without TaskCreationOptions.RunContinuationsAsynchronously,
each SetResult/SetException runs the awaiter's continuation inline on
that native callback thread. That risks deadlock when the continuation
re-enters Interop.WiFi.* synchronously, and pins user code to the
callback thread instead of the ThreadPool/SynchronizationContext.
Adds the flag to all 13 TaskCompletionSource construction sites:
 WiFiManagerImpl.cs: Activate, ActivateWithWiFiPickerTested, Deactivate,
 Scan, ScanSpecificAP, BssidScan, HiddenAPConnect,
 StartMultiScan (8)
 WiFiAP.cs: Connect, ConnectWps, ConnectWpsWithoutSsid,
 Disconnect, ForgetAP (5)
No public API change. Behavior change is limited to which thread runs the
awaiter's continuation, which matches the documented async contract.
Fixes #7620 

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates multiple instantiations of TaskCompletionSource in WiFiAP.cs and WiFiManagerImpl.cs to use TaskCreationOptions.RunContinuationsAsynchronously. This ensures that task continuations are executed asynchronously, preventing potential deadlocks and improving thread pool utilization. There are no review comments, so we have no feedback to provide.

Copy link
Copy Markdown
Member Author

🤖 [AI Review]

Reviewed — no findings.

Scope checked:

  • All 13 TaskCompletionSource construction sites updated uniformly: 8 in WiFiManagerImpl.cs (ActivateAsync, ActivateWithWiFiPickerTestedAsync, DeactivateAsync, ScanAsync, ScanSpecificAPAsync, BssidScanAsync, HiddenAPConnectAsync, StartMultiScan) and 5 in WiFiAP.cs (ConnectAsync, ConnectWpsAsync, ConnectWpsWithoutSsidAsync, DisconnectAsync, ForgetAPAsync).
  • Constructor-only change: no public API signature changes, no behavior change for callers awaiting the returned Task.
  • Intended semantic effect: continuations no longer run inline on the native callback thread, eliminating the inline-sync-wait deadlock class typical of native-callback-driven TCS code.
  • TaskCreationOptions overload is available on the target TFMs (net6.0/net8.0).
  • All affected TCS are TaskCompletionSource<bool> or TaskCompletionSource<WiFiAP> — no TaskCompletionSource (non-generic) sites left unconverted.

No 🔴 critical issues, no 🟡 suggestions to flag.


Automated review — final merge decision rests with human reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chleun-moon chleun-moon Awaiting requested review from chleun-moon chleun-moon is a code owner

1 more reviewer

@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

1 participant

AltStyle によって変換されたページ (->オリジナル) /