Skip to content

Commit

Permalink
Fix a panic condition in the RX example.
Browse files Browse the repository at this point in the history
This would occur when the sample thread disconnected
before the main thread requested a disconnection.
  • Loading branch information
newAM committed May 21, 2021
1 parent e29ade3 commit 4c7edbc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Added tested platforms to the README.

### Fixed
- Fixed a panic condition in the `rx` example that occurred when the sample
thread disconnected before the main thread requested a disconnection.

## [0.2.0] - 2021-05-09
### Added
- Added `impl std::error::Error for Error`.
Expand Down
7 changes: 4 additions & 3 deletions examples/rx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ fn main() {

println!("Shutting down sample thread");

exit_tx
.send(())
.expect("Failed to send exit event to sample thread");
if let Err(e) = exit_tx.send(()) {
println!("Failed to send exit event (receiver disconnected): {}", e);
}

sample_thread
.join()
.expect("Failed to join sample thread")
Expand Down

0 comments on commit 4c7edbc

Please sign in to comment.