EpicSkookumScript / EpicSkookumScript/SkookumScript-Plugin

Coroutine pending_increment does not halt execution of coroutine

未关闭
#7 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
C++
星标
138
派生
22
PR 合并指标
30 天内没有已合并 PR

描述

**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.

贡献指南

打开贡献指南

调研方向

使用示例和 UE4 4.22 设置,在 REPL 中重现 coroutine 的行为。跟踪 pending_increment 在 SkMind 的待处理列表中的流转,并检查 m_pending_count 如何影响执行;完成的标准是 c1 在递增后停止,并在 pending_decrement 后恢复执行,与预期输出一致。

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp, unreal-engine
领域
game-dev
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。