EpicSkookumScript / EpicSkookumScript/SkookumScript-Plugin
Coroutine pending_increment does not halt execution of coroutine
- Langage dominant
- C++
- Étoiles
- 138
- Forks
- 22
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
**Issue by [error454](https://github.com/error454)**
_Wednesday Jul 03, 2019 at 03:02 GMT_
_Originally opened as https://github.com/SkookumScript/SkookumScript-Plugin/issues/7_
----
**UE4 Version**
4.22
**SkookumScript Version**
4.22
**Describe the bug**
Calling `pending_increment` does not suspend a running coroutine as the documentation alludes to.
> // Increments the number of expressions / tasks currently executing in
> // parallel that the invoked object is waiting for a return value from.
> // If the number was 0 and is increased then the invoked object will be
> // suspended until the pending number is reduced back to 0 by calling
> // pending_decrement().
**To Reproduce**
Run the following sample code in the REPL
```javascript
// Coroutine suspend test
!x : 0
!y : 0
!f : (Integer in)[in += 1]
!c1 : branch[loop[f(x) _wait(1.0)]]
!c2 : branch[loop[f(y) _wait(1.0)]]
race
[
loop
[
println(x, ".", y)
_wait(1.0)
]
[
_wait(2)
c1.pending_increment(1)
_wait(1)
c1.pending_decrement
_wait(10)
]
]
// Expected Output:
// 0.0
// 1.1
// 1.2
// 2.3
// ...
```
**Expected behavior**
After calling `c1.pending_increment(1)` the `c1` coroutine should stop running until I call `c1.pending_decrement`.
**Additional context**
I've done some debugging around this. When I break on the call to `c1.pending_increment`, I see that `c1` already has an `m_pending_count` of 1, which means the coroutine is already on the `SkMind`'s pending list. I simply don't see any glue that stops execution of the coroutine once it is on that list.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Reproduisez le comportement de la coroutine dans la REPL en utilisant l’exemple et la configuration UE4 4.22. Suivez pending_increment dans la liste des éléments en attente de SkMind et examinez comment m_pending_count affecte l’exécution ; le travail est terminé lorsque c1 s’arrête après l’incrémentation et reprend après pending_decrement, conformément à la sortie attendue.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- cpp, unreal-engine
- Domaine
- game-dev
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100