Document main actor execution requirements in Java-hosted processes
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
非同期 Swift API と Java ホスト型プロセスを扱うドキュメントを探してください。issue では特定のファイルが指定されていないため、まず該当するドキュメントのエントリーポイントを見つけてください。Swift のメインエグゼキューターに依存する呼び出しは、ホスト環境によっては進行しなくなる可能性があり、ホスト側の統合が必要になる場合があることを説明してください。ユーザーがこの制限を見つけ、その原因を理解できるようになれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem
swift-java can export asynchronous Swift functions annotated with @MainActor to Java. However, depending on the host environment, a call may stop making progress when it switches to the main actor. This can happen not only when the exported function is itself annotated with @MainActor, but also when a Swift library uses the main actor internally.
It is natural for swift-java users to expect @MainActor, a standard Swift language feature, to work as usual. As a result, they may not immediately recognize the cause of the problem. The issue is also technically complex, making it difficult for many users to address.
For an example, see:
Technical background
This problem occurs when work submitted to Swift's main executor is not executed in the host environment.
When a Swift executable is launched, its entry point and platform environment are responsible for running asynchronous work and event loops. In contrast, when a Java application calls Swift, the Java host manages the process entry point and event loop. swift-java generates bindings for Swift libraries used in that process. Depending on the host environment, additional integration may therefore be needed to run Swift's main executor.
For example, swift-android-native provides an implementation that uses the private libdispatch API _dispatch_main_queue_callback_4CF to process the Dispatch main queue used by Swift's main executor on the Android main looper.
Proposal
Ideally, users should be able to use Swift code that relies on @MainActor without additional effort. However, swift-java does not own the host process's entry point or event loop, and the necessary integration depends on the host environment and application configuration.
As a first step, I propose updating the documentation so that users can discover this limitation and understand that host-side integration may be needed. I am preparing a PR for the documentation update.
Future directions
In the future, it may be worth considering whether swift-java should provide an implementation to run the main executor. For example, one possibility would be to start a dedicated thread at JNI_OnLoad to drive the Swift main executor.
- 主要言語
- Swift
- スター
- 1.3k
- フォーク
- 129
- 平均マージ
- 7時間 16分
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
swiftlang/swift-java のほかの issue
-
wrap-java: Optional convenience methods can fail to compile when a parameter shadows the method nameオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
swiftlang/swift-java#945 ·
メンテナーはふだん 1 日以内に返信
-
android
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
swiftlang/swift-java#663 · コメント 4 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
swiftlang/swift-java#949 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
swiftlang/swift-java#948 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 54/100
swiftlang/swift-java#947 ·
メンテナーはふだん 1 日以内に返信
swiftlang/swift-java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
rock3r/remozio#600 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug JSON
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
nightscout/Trio#1748 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
carp-dk/flutter-plugins#1312 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
newrelic/newrelic-flutter-agent#256 ·
メンテナーはふだん 1 日以内に返信