jextract/jni: Propagate CompletableFuture cancellation to Swift tasks
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 54/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- mobile-dev
Línea de trabajo
Start by tracing the JNI async call and generated thenApply result-conversion stage described in the issue, then review the reference workaround in the linked pull request. Check how cancellation reaches the source future and the Swift task; done means cancelling the returned Java future forwards cancellation to the Swift task so cooperative operations such as Task.sleep can observe it.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
Cancelling a future returned by a JNI async call currently changes only the Java future's state. The underlying Swift task keeps running. The generated thenApply result-conversion stage also prevents cancellation of the returned future from reaching the source future.
Example
public func waitForWork() async throws -> Int64 {
try await Task.sleep(for: .seconds(60))
return 1
}
A Java caller can cancel the returned future:
var future = MySwiftLibrary.waitForWork();
future.cancel(false);
The Java future is cancelled, but the Swift task continues running. Cancellation of the returned future should also be forwarded to the Swift task, so cancellation-aware operations such as Task.sleep can observe it.
Swift cancellation is cooperative: forwarding cancellation does not interrupt an operating-system thread or wait for the task to finish.
Reference workaround implementation: https://github.com/qoncept/swift-java/pull/10
- Lenguaje dominante
- Swift
- Estrellas
- 1.3k
- Forks
- 127
- Merge medio
- 2 d 14 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de swiftlang/swift-java
-
wrap-java: Optional convenience methods can fail to compile when a parameter shadows the method nameAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
swiftlang/swift-java#945 ·
Los mantenedores suelen responder en 1 día
-
android
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
swiftlang/swift-java#663 · 4 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 56/100
swiftlang/swift-java#949 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
swiftlang/swift-java#948 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 53/100
swiftlang/swift-java#946 ·
Los mantenedores suelen responder en 1 día
Todos los issues de swiftlang/swift-java
Issues similares
-
Tests fail when the Mac isn't set to EnglishPosiblemente ocupada @zolferfigueiredo la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 3 días
-
area:shell order:3 status:ready type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
krystianslowik/arkt#618 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
nightscout/Trio#1741 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
deepsealabs/libdc-swift#107 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
alexandrereol/ethmensa#30 ·