Skip to content

Commit

Permalink
Getting ready for a release.
Browse files Browse the repository at this point in the history
  • Loading branch information
uberFoo committed Nov 28, 2023
1 parent 5856725 commit 84c5e82
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.3] - 2023-11-28

### Added

- code coverage
- additional tests

### Changed

- made Executor::root_worker public

### Fixed

- clippy lints
Expand Down Expand Up @@ -41,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Initial release of crate. Basic functionality is there, it just needs some
documentation ond fine tuning of the API.

[unreleased]: https://github.com/uberfoo/puteketeke/compare/v0.0.2...develop
[unreleased]: https://github.com/uberfoo/puteketeke/compare/v0.0.3...develop
[0.0.3]: https://github.com/uberfoo/puteketeke/compare/v0.0.2...v0.0.3
[0.0.2]: https://github.com/uberfoo/puteketeke/compare/v0.0.1...v0.0.2
[0.0.1]: https://github.com/uberFoo/puteketeke/releases/tag/v0.0.1
36 changes: 32 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
//! # Async Executor
//!
//! This crate is what you might build if you were to add a thread pool to [smol](https://github.com/smol-rs/smol), and wanted paused tasks.
//! ![Build Status](https://github.com/uberFoo/puteketeke/workflows/Rust/badge.svg)
//! [![codecov](https://codecov.io/gh/uberFoo/puteketeke/graph/badge.svg?token=eCmOPZzxX5)](https://codecov.io/gh/uberFoo/puteketeke)
//! ![Lines of Code](https://tokei.rs/b1/github/uberfoo/puteketeke)
//!
//! This crate is what you might build if you were to add a thread pool to [smol](https://github.com/smol-rs/smol), and tasks to start paused.
//!
//! I take somewhat the opposite approach to Tokio.
//! (I assume, I've never actually used Tokio.)
Expand All @@ -9,7 +13,7 @@
//! I take the approach that most of the main code is synchronous, with async code as needed.
//! This is exactly the situation I found myself in when I wanted to add async support to my language, [dwarf](https://github.com/uberFoo/dwarf).
//!
//! ## Hello Worild
//! ## Hello World
//!
//! ```
//! // Create an executor with four threads.
Expand Down Expand Up @@ -938,6 +942,30 @@ mod tests {

let (a, b) = future::block_on(future::zip(task_0, task_1));
assert!(b < a);

let inner_executor = executor.clone();
let task_2 = executor
.create_task(async move {
let now = Instant::now();
inner_executor.timer(Duration::from_millis(100)).await;
now.elapsed()
})
.unwrap();

let inner_executor = executor.clone();
let task_3 = executor
.create_task(async move {
let now = Instant::now();
inner_executor.timer(Duration::from_millis(500)).await;
now.elapsed()
})
.unwrap();

executor.start_task(&task_2);
executor.start_task(&task_3);

let (c, d) = future::block_on(future::zip(task_2, task_3));
assert!(c < d);
}

#[test]
Expand Down Expand Up @@ -1067,8 +1095,8 @@ mod tests {

worker.start_task(&task1);

let _ = future::block_on(task0);
let _ = future::block_on(task1);
future::block_on(task0);
future::block_on(task1);

worker.destroy();
assert_eq!(1, executor.worker_count());
Expand Down

0 comments on commit 84c5e82

Please sign in to comment.