Commit Graph

64 Commits

Author SHA1 Message Date
James Liu a16e1d3c51
m: Remove the dependency on async-lock
This PR removes the need for async-lock as a dependency by making the Executor initializable in a const context. This relies on the const initialization of CondVars and Mutexes, so the MSRV was bumped to 1.63.
2024-05-13 18:58:39 -07:00
James Liu 393659524e
Make tracing optional (#60) 2024-04-21 17:04:01 -07:00
John Nunley 02cd156338
feat: Propogate panics that occur in unblocked functions
This commit makes it so if a panic occurs in an unblock task, that panic
is propogated to the caller. Previously, the task would just fail to
complete and would produce a less intuitive error.

Tests are also added to make sure the panic is propogated.

Signed-off-by: John Nunley <dev@notgull.net>
2024-04-20 12:11:46 -07:00
Taiki Endo 22eaea7505 Fix redundant import warning
```
error: the item `AsyncRead` is imported redundantly
   --> src/lib.rs:105:18
    |
105 | use futures_io::{AsyncRead, AsyncSeek, AsyncWrite};
    |                  ^^^^^^^^^
106 | use futures_lite::{future, prelude::*, ready};
    |                            ---------- the item `AsyncRead` is already imported here
    |
    = note: `-D unused-imports` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_imports)]`

error: the item `AsyncSeek` is imported redundantly
   --> src/lib.rs:105:29
    |
105 | use futures_io::{AsyncRead, AsyncSeek, AsyncWrite};
    |                             ^^^^^^^^^
106 | use futures_lite::{future, prelude::*, ready};
    |                            ---------- the item `AsyncSeek` is already imported here

error: the item `AsyncWrite` is imported redundantly
   --> src/lib.rs:105:40
    |
105 | use futures_io::{AsyncRead, AsyncSeek, AsyncWrite};
    |                                        ^^^^^^^^^^
106 | use futures_lite::{future, prelude::*, ready};
    |                            ---------- the item `AsyncWrite` is already imported here
```
2024-03-03 06:47:18 -08:00
John Nunley 96764936db
bugfix: Fix compilation on wasm32
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-12 16:22:36 -08:00
John Nunley d5189ef606 Bump async-channel, async-lock and futures-lite
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-04 09:14:11 -07:00
Leonz 23a26e98b2
m: change Executor grow_pool fn error span to tracing span 2023-10-05 17:44:28 -07:00
John Nunley f89581310d
Add smol-rs logo (#41) 2023-07-17 14:32:48 +09:00
John Nunley 1e835fb4ae
feat: Setup tracing instrumentation
Replace the `log` crate with `tracing`. See this comment for more information:
https://github.com/smol-rs/blocking/pull/31#discussion_r1059248293
2023-06-13 21:25:36 -07:00
John Nunley 75cb224b1f
Use piper for read/write pipes (#37) 2023-05-07 17:44:46 +02:00
John Nunley 610f8b161c
Remove memchr dependency (#38) 2023-04-30 12:35:09 -07:00
John Nunley dbdef7e55b
Gracefully handle the inability to spawn threads, take 2 (#31)
* Gracefully handle the inability to spawn threads

* Ensure the thread limit is never zero
2022-12-30 10:14:18 -08:00
John Nunley 6e779c1960
Replace once_cell with async-lock (#30) 2022-10-29 21:41:12 -07:00
Taiki Endo 2f530a4696 Fix clippy::borrow_deref_ref warning
```
warning: deref on an immutable reference
   --> src/lib.rs:590:30
    |
590 |                 let io: &T = &*io;
    |                              ^^^^
    |
    = note: `#[warn(clippy::borrow_deref_ref)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
help: if you would like to reborrow, try removing `&*`
    |
590 |                 let io: &T = io;
    |                              ~~
help: if you would like to deref, try using `&**`
    |
590 |                 let io: &T = &**io;
    |                              ~~~~~
```
2022-07-02 23:45:10 +09:00
Taiki Endo 8dae6af497 Use #[doc(no_inline)] on re-exports 2022-03-13 00:17:41 +09:00
Zhixing Zhang 501cfc2d48
cargo fmt 2022-03-06 00:06:26 -08:00
Zhixing Zhang 176c6605d9
unblock returns Task 2022-03-05 16:49:25 -08:00
Taiki Endo 14365a8022 Fix clippy::unnecessary_lazy_evaluations warning 2022-01-08 22:35:54 +09:00
Jarema 26c8505e23 Improve docs 2021-10-02 10:12:22 +02:00
Jarema 7af5824e77 Add docs about threads; refactor threads max/min value logic 2021-10-01 21:11:32 +02:00
Jarema 54e701fb29 Make conditionals more concise 2021-09-29 22:03:22 +02:00
Jarema 8a2cdbba94 Add min and max values 2021-09-29 21:49:52 +02:00
Jarema 5e1321afb7 Rename max threads env variable 2021-09-27 22:55:58 +02:00
Jarema af9ec51587 Add test for not number env value 2021-09-27 13:47:39 +02:00
Jarema 4855caeec7 Reformat EXECUTOR initialization 2021-09-27 13:33:07 +02:00
Jarema 8a156a99d1 Make max_threads customizable 2021-09-27 13:17:31 +02:00
Taiki Endo 757968b1bd Update URLs 2020-12-26 23:47:13 +09:00
Stjepan Glavina 6ea0edac10 Update futures-lite 2020-10-09 14:25:10 +02:00
Stjepan Glavina f68c879bfb Use async-task 2020-10-05 12:05:13 +02:00
Stjepan Glavina 1726b358bc More docs 2020-09-22 23:36:27 +02:00
Stjepan Glavina b7df9af87e Remove let _ pattern 2020-09-13 13:43:54 +02:00
Stjepan Glavina 5fd1520417 Add automatic yielding 2020-08-28 14:49:33 +02:00
Stjepan Glavina c5ccee138f Remove the unblock macro 2020-08-26 23:03:57 +02:00
Stjepan Glavina 3711d561b4 Implement Sync for Unblock 2020-08-18 16:22:36 +00:00
Stjepan Glavina a68ecb7ce1 Add a note on buffering 2020-08-14 11:26:41 +02:00
Stjepan Glavina fd3281e476 Add Unblock::with_capacity 2020-08-13 21:19:04 +02:00
Stjepan Glavina 9e8fa8ec13 Add unblock method 2020-08-13 20:52:06 +02:00
Stjepan Glavina a9f77685de Don't double-box Task 2020-08-13 20:46:32 +02:00
Stjepan Glavina 9767f7437c Open files with unblock macro 2020-08-04 22:27:40 +02:00
Stjepan Glavina 4651a353c2 Typo 2020-07-22 19:09:17 +02:00
Stjepan Glavina c2175437bd Simplify the API 2020-07-21 20:41:03 +02:00
Stjepan Glavina da7d409fb3 Simplify dependencies 2020-07-19 17:51:43 +02:00
Stjepan Glavina 8c04ac08bf
Fix incorrect doc comment 2020-06-29 16:38:09 +02:00
Stjepan Glavina c898de0c0b Stop writing if pipe gets closed 2020-06-22 11:21:49 +02:00
Stjepan Glavina 31594d8df5 Update comment on Unblock 2020-06-17 23:02:55 +02:00
Stjepan Glavina b7d4648079 Typo 2020-06-17 21:53:37 +02:00
Stjepan Glavina 7f64f99a77 Implement seeking 2020-06-17 21:52:00 +02:00
Stjepan Glavina 9965c07cb2 Remove the initial poll with no waker 2020-05-31 01:27:10 +02:00
Stjepan Glavina 8e93c68d6b Typo 2020-05-27 21:14:22 +02:00
Stjepan Glavina 04f65c382f Fuse the receiver stream 2020-05-23 14:43:44 +02:00