Skip to content

Make client initialization thread safe #8

Description

@nirs

Theoretically it can be called by multiple threads, creating multiple connections. Practically this will never happen since it is called once from main().

If we want to fix it we can use something like:

static pthread_once_t connect_once = PTHREAD_ONCE_INIT;

xpc_object_t vmnet_broker_start_session(const char *network_name, struct vmnet_broker_error *err) {
    pthread_once(&connect_once, connect_to_broker);
    ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions