Skip to content

Investigate "wait" block to avoid busy-waiting #213

@towerofnix

Description

@towerofnix

Following #212, the current implementation for Sprite.wait will busy-wait if no other active threads are requesting a screen refresh.

Our Sprite.wait is (loosely?) modeled after scratch-vm: wait, stack timer, Timer.

If it's possible to implement "wait" in terms of a promise, this would avoid busy-waiting. However, we obviously need to retain behavior semantics, i.e. not break any existing behavior.

I don't know if there have been any previous efforts or discussion, particularly in scratch-vm, to implement "wait" in terms of a promise (and thus consideration of compatibility concerns). We did a cursory look for pull requests and didn't spot anything, but it might be worth a closer look!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions