Skip to content

Implement optimized dispatch_once #1

Closed
@SSheldon

Description

@SSheldon

dispatch_once_f is redefined as:

void _dispatch_once_f(dispatch_once_t *predicate, void *context, dispatch_function_t function)
{
    if (__builtin_expect(*predicate, ~0l) != ~0l) {
        dispatch_once_f(predicate, context, function);
    }
}

This requires the expect builtin, which isn't exposed as an intrinsic in Rust. Implementing this would be possible if rust-lang/rfcs#918 is accepted and implemented.

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