Skip to content

subjects::synchronize lock with current_thread or immediate scheduler #491

@lebdron

Description

@lebdron
rxcpp::composite_subscription lifetime;
rxcpp::subjects::synchronize<int, rxcpp::identity_one_worker> sub(
    rxcpp::identity_current_thread(), lifetime);

sub.get_subscriber().on_next(1);
lifetime.unsubscribe();

This code locks in drain_queue

std::unique_lock<std::mutex> guard(lock);

because the lock in on_next is not unlocked
std::unique_lock<std::mutex> guard(lock);

Should it be safe to call unlock before these lines?

auto processor = coordinator.get_worker();
processor.schedule(lifetime, selectedDrain.get());

schedule should be thread-safe by contract if I am not mistaken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions