Skip to content

Multithreaded world causes deadlock in Godot #2

Closed
@tvenclovas96

Description

@tvenclovas96

Trying to step with B2Api.b2DefaultWorldDef_WithDotNetTpl() causes a deadlock in Godot C#. This is due to the engine providing it's own SynchronizationContext which forces continuations on the main thread.

Adding .ConfigureAwait(false) here seems sufficient

await Task.WhenAll(tasks);

(As a sidenote, the Task.Factory.StartNew just above the mentioned line could also be replaced with a Task.Run, which would be a more "canonical" choice)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions