Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread and RunLoopMode.common in not available on WASM #5581

Open
Kyle-Ye opened this issue Apr 21, 2024 · 1 comment
Open

Thread and RunLoopMode.common in not available on WASM #5581

Kyle-Ye opened this issue Apr 21, 2024 · 1 comment

Comments

@Kyle-Ye
Copy link

Kyle-Ye commented Apr 21, 2024

Encounter some Thread related WASM error recently.

import Foundation

// Works on Ubuntu and macOS
@inline(__always)
func performOnMainThread(_ block: @escaping () -> Void) {
    if Thread.isMainThread {
        block()
    } else {
        RunLoop.main.perform(inModes: [.common], block: block)
    }
}
ThreadUtils.swift:15:41: error: reference to member 'common' cannot be resolved without a contextual type
        RunLoop.main.perform(inModes: [.common], block: block)
                                        ^
ThreadUtils.swift:12:8: error: cannot find 'Thread' in scope
    if Thread.isMainThread {

Is this an expected behavior and #5548 already keeps track of the issue?

@kateinoigakukun
Copy link
Member

This is expected since we don't enable any RunLoop feature at this moment. Might be unblocked after porting libdispatch with threading support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To triage
Development

No branches or pull requests

2 participants