Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

program quits when using async/await #15

Open

Description

When using async/await, The program quits. I have tried only using Raylib commands on the Main Actor and main thread. Still crashes if there is an await.

I got it working with the following work around; however, this ties up the main thread with a semaphore.

 @MainActor static func main() {
 Raylib.initWindow(800, 450, "test")
 Raylib.setTargetFPS(60)
 
 while Raylib.windowShouldClose == false {
 let semaphore = DispatchSemaphore(value: 0)
 DispatchQueue.global().async {
 Task {
 await update()
 semaphore.signal()
 }
 }
 semaphore.wait()
 draw()
 }
 
 Raylib.closeWindow()
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /