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

Add create_signal_from_stream function #545

Merged
merged 4 commits into from
Aug 12, 2024

Commits on Aug 10, 2024

  1. Add create_signal_from_stream function

    I think this is a better implementation of create_signal_from_tokio_channel:
    
    - This implementation properly handles the effect callback being dropped (when the parent scope is disposed?) by dropping the stream
    - This implementation does not need to spawn a new task, and therefore is runtime independant
    - This implementation is generic over streams (including futures::channel::Receiver)
    - This implementation avoids having the value wrapped in an `Option` (if no initial value is available, it is easy to map the stream to wrap values in a `Some` with [`StreamExt::map`](https://docs.rs/futures/latest/futures/stream/trait.StreamExt.html#method.map)
    - This implementation does not require the value to be `Send`
    sgued committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    b4585a7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    076c226 View commit details
    Browse the repository at this point in the history
  3. Prevent deadlocks when triggers for external events are registered in…

    … an effect
    
    for a trigger for an external event.
    
    The locks were held for longer than necessary. This lead to a deadlock if an
    external event re-registered itself directly in an effect for itself.
    
    This should also improve performance as the contention should be lower, and the lock
    is locked only once in the idle state.
    sgued committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    71a21b7 View commit details
    Browse the repository at this point in the history
  4. Remove recursive registering of events

    The ext-event-handlers registers triggers to be handled in the idle of the app,
    so the effect can never run recursively
    sgued committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    a884adc View commit details
    Browse the repository at this point in the history