Oliver Rockstedt
fa05256f05
embassy-sync: Add len, is_empty and is_full functions to Channel.
2024-04-08 00:40:42 +02:00
Alex Moon
c9acebf783
Fix FairSemaphore
bugs
...
- `acquire` and `acquire_all` futures were `!Send`, even for `M: RawMutex + Send` due to the captured `Cell`.
- If multiple `acquire` tasks were queued, waking the first would not wake the second, even if there were permits remaining after the first `acquire` completed.
2024-04-03 19:13:57 -04:00
Alex Moon
f8a6007e1c
Semaphore synchronization primitive
...
This provides both a "greedy" and "fair" async semaphore implementation.
2024-03-30 22:25:41 -04:00
Alexandru Radovici
a38cbbdc59
fix typo
2024-03-30 22:36:30 +02:00
Dario Nieuwenhuis
c2aa95016a
Merge pull request #2727 from de-vri-es/forward-std-feature-to-critical-section
...
Forward the "std" feature to the critical-section crate in embassy-sync.
2024-03-22 11:34:45 +00:00
Maarten de Vries
a85e9c6e68
Forward the "std" feature to the critical-section crate in embassy-sync.
...
Otherwise, using embassy-sync in unit tests will result in linker errors
when using the CriticalSectionRawMutex.
2024-03-22 12:29:01 +01:00
Ulf Lilleengen
3668ace35c
Merge pull request #2651 from peterkrull/once_lock
...
Add `OnceLock` sync primitive
2024-03-22 08:40:27 +00:00
Dario Nieuwenhuis
3d842dac85
fmt: disable "unused" warnings.
2024-03-20 14:53:19 +01:00
Noah Bliss
d06dbf332b
Doc update: signaled does not clear signal
...
signaled does not clear signal (doc update)
2024-03-20 03:19:01 +00:00
Ulf Lilleengen
c0d91600ea
rustfmt
2024-03-12 15:37:53 +01:00
Ulf Lilleengen
8bb1fe1f65
Add conversion into dyn variants for channel futures
2024-03-12 15:27:52 +01:00
Dario Nieuwenhuis
60567b72fb
Merge pull request #2660 from embassy-rs/zerocopy-docs
...
docs: clarify capabilities of zerocopy channel
2024-03-04 17:52:03 +00:00
Ulf Lilleengen
2a25757377
docs: clarify capabilities of zerocopy channel
2024-03-04 18:36:34 +01:00
Peter Krull
245e7d3bc2
This one is for ci/rustfmt
2024-03-03 15:43:01 +01:00
Peter Krull
4bbcc2a7fb
Add OnceLock sync primitive
2024-03-03 15:35:52 +01:00
Peter Krull
69d37503c2
Add constructor for dynamic channel
2024-03-02 13:13:26 +01:00
Peter Krull
e02a987baf
This one is for cargo fmt
2024-03-02 00:16:17 +01:00
Peter Krull
311ab07a9a
Reintroduce predicate methods. Add ability for sender to modify value in-place.
2024-03-02 00:14:11 +01:00
Peter Krull
df282aa23d
Forgot to update doc comment
2024-02-29 16:59:58 +01:00
Peter Krull
c08e75057a
Update tests to reflect changes in previous commit
2024-02-29 16:58:21 +01:00
Peter Krull
3208e0fec4
Use Option instead of Result for receiver creation since it is the only way it can fail.
2024-02-29 16:56:52 +01:00
Peter Krull
ae2f109921
Added sender types, support for dropping receivers, converting to dyn-types, revised tests.
2024-02-29 16:45:44 +01:00
Peter Krull
6defb4fed9
Changed name to Watch
, added DynReceiver
, get
-method and more reworks.
2024-02-28 20:59:38 +01:00
Peter Krull
2f58d1968a
Updated formatting
2024-02-14 01:27:48 +01:00
Peter Krull
24a4379832
Got closures to work in async, added bunch of tests
2024-02-14 01:23:11 +01:00
Peter Krull
37f1c9ac27
Removed unused lifetime, change most fn -> FnMut
2024-02-13 23:14:16 +01:00
Peter Krull
410c2d440a
Change import formatting
2024-02-13 15:37:07 +01:00
Peter Krull
26acee2902
Add initial implementation of MultiSignal
sync primitive
2024-02-13 14:50:26 +01:00
Stefan Gehr
b9d0069671
correct spelling of the word "receive"
2024-02-03 14:56:31 +01:00
Sam Lakerveld
15e9b60abb
sync/pipe: be able to be zero-initialized
2024-02-01 13:47:07 +01:00
Dario Nieuwenhuis
6a1c415a4c
Complete cargo.tomls more.
2024-01-12 00:32:47 +01:00
Dario Nieuwenhuis
b452a6bcf6
Centralize license and MSRV boilerplate into the repo readme.
2024-01-11 18:18:35 +01:00
Dario Nieuwenhuis
fe0b21e21e
Remove nightly autodetects.
2024-01-10 18:32:14 +01:00
Rasmus Melchior Jacobsen
13c107e815
Put waiting state back if any
2023-12-20 13:09:16 +01:00
Rasmus Melchior Jacobsen
f9d0daad80
feat(embassy-sync): Add try_take() to signal
2023-12-20 08:37:15 +01:00
Scott Mabin
a6f4538219
embassy-sync 0.5
2023-12-04 13:10:41 +00:00
Dario Nieuwenhuis
c6989dfbca
Remove nightly and unstable-traits features in preparation for 1.75.
2023-11-29 17:26:33 +01:00
Dario Nieuwenhuis
4634316749
Update embedded-(hal,io,nal).
2023-11-29 17:01:36 +01:00
Scott Mabin
454828accb
revert module changes, reexport heapless relevant items
2023-11-20 11:28:31 +00:00
Scott Mabin
5a60024af7
docs
2023-11-18 15:09:41 +00:00
Scott Mabin
f482a105b8
more clean up, refactor channel into module to share code
2023-11-18 15:01:12 +00:00
Scott Mabin
7589b5e13e
reduce duplication further by sharing Dynamic sender/receiver
2023-11-18 14:56:29 +00:00
Scott Mabin
2efa73f431
docs and simple test for priority
2023-11-18 14:37:15 +00:00
Scott Mabin
270ec324b0
Reduce duplication, fix tests
2023-11-18 14:31:09 +00:00
Scott Mabin
ca0d02933b
Priority channel using binary heap
2023-11-18 14:21:43 +00:00
Dario Nieuwenhuis
4647df14b1
Update heapless to v0.8, embedded-nal-async to v0.7
2023-11-10 16:43:53 +01:00
Dario Nieuwenhuis
1f51367eb9
Upgrade static-cell to v2.0
2023-11-02 21:52:07 +01:00
Dániel Buga
d941882066
Prepare embassy-net 0.2.1 and embassy-sync 0.4.0
2023-10-31 09:33:27 +01:00
Dániel Buga
ad07ea0290
Re-add impl_trait_projections
2023-10-30 19:10:45 +01:00
Dario Nieuwenhuis
0324cee0ca
update embedded-io, embedded-nal-async.
2023-10-04 00:10:55 +02:00
Dario Nieuwenhuis
eb12114345
Remove impl_trait_projections.
2023-10-02 14:00:49 +02:00
Ulf Lilleengen
1b20ba27b1
feat: bump embassy-sync version to 0.3.0
...
Update changelog in preparation for release
2023-09-14 18:26:00 +02:00
Dario Nieuwenhuis
615882ebd6
Rename zero_copy -> zerocopy.
2023-09-04 22:16:28 +02:00
Ruben De Smet
6e38b07642
Add docs to zero-copy-channel
2023-09-04 22:13:27 +02:00
Ruben De Smet
1eb03dc41a
Prefer receive
over recv
2023-09-04 22:13:27 +02:00
Ruben De Smet
a2656f402b
Move embassy-net-driver-channel::zerocopy_channel to embassy_sync::zero_copy_channel
2023-09-04 22:13:27 +02:00
Dario Nieuwenhuis
9baa3bafb0
Merge pull request #1854 from bugadani/str
...
embassy-{net, sync, time}: Use fmt::unwrap
2023-09-03 00:35:21 +02:00
Dániel Buga
0c66636d00
Use fmt::unwrap
2023-09-02 08:39:52 +02:00
Dario Nieuwenhuis
5e613d9abb
Sync all fmt.rs files.
2023-08-30 01:37:18 +02:00
Dario Nieuwenhuis
6c165f8dc0
sync/pipe: impl BufRead.
2023-08-30 01:06:41 +02:00
Dario Nieuwenhuis
b3212ae383
Merge pull request #1763 from rubdos/sender-receiver-with-ctx
...
Refactor Channel/Sender/Receiver poll methods
2023-08-22 21:25:29 +00:00
Ruben De Smet
c39671266e
Deprecate *recv* in favor of *receive*
2023-08-22 16:58:31 +02:00
Dániel Buga
8655ba110c
Fix typo
2023-08-15 19:13:36 +02:00
Ruben De Smet
b1ec460b9a
Implement Channel::poll_receive(..) -> Poll<T>
2023-08-11 13:22:56 +02:00
Ruben De Smet
f9d251cd5c
Channel poll methods return Poll instead of bool
2023-08-11 12:13:46 +02:00
Ruben De Smet
b658f10db9
Expose poll_ready_to_{send,receive} in Sender/Receiver
2023-08-11 12:13:42 +02:00
Sam Lakerveld
2ab9a07b64
embassy-sync: manual Copy impls for channel and pipe
2023-08-08 11:22:01 +02:00
Dario Nieuwenhuis
5d5cd23715
Update to embedded-io 0.5 ( #1752 )
2023-08-07 13:43:09 +02:00
xoviat
890d113b85
wpan: fully implement initial draft concept
2023-07-18 18:28:12 -05:00
Dario Nieuwenhuis
f5ca687e9b
sync/pipe: fix doc typos.
2023-06-27 23:49:12 +02:00
Dario Nieuwenhuis
3465452a93
fmt: remove unused defmt::timestamp!
2023-06-09 03:33:39 +02:00
ZhangYong
24c4ea71b1
sync/pipe: write all user data to pipe
...
sync/pipe: add write_all function
2023-06-04 22:29:59 +08:00
Dario Nieuwenhuis
1d8321b821
Use make_static! from static-cell v1.1
2023-06-01 01:42:34 +02:00
Dario Nieuwenhuis
3081ecf301
sync: do will_wake check in MultiWakerRegistration.
2023-05-26 13:17:39 +02:00
Dario Nieuwenhuis
9f7392474b
Update Rust nightly.
2023-05-19 17:12:39 +02:00
Dario Nieuwenhuis
577f060d24
Release embassy-sync v0.2.0
2023-04-13 23:40:49 +02:00
Dario Nieuwenhuis
80972f1e0e
executor,sync: add support for turbo-wakers.
...
This is a `core` patch to make wakers 1 word (the task pointer) instead of 2 (task pointer + vtable). It allows having the "waker optimization" we had a while back on `WakerRegistration/AtomicWaker`, but EVERYWHERE, without patching all crates.
Advantages:
- Less memory usage.
- Faster.
- `AtomicWaker` can actually use atomics to load/store the waker, No critical section needed.
- No `dyn` call, which means `cargo-call-stack` can now see through wakes.
Disadvantages:
- You have to patch `core`...
- Breaks all executors and other things that create wakers, unless they opt in to using the new `from_ptr` API.
How to use:
- Run this shell script to patch `core`. https://gist.github.com/Dirbaio/c67da7cf318515181539122c9d32b395
- Enable `build-std`
- Enable `build-std-features = core/turbowakers`
- Enable feature `turbowakers` in `embassy-executor`, `embassy-sync`.
- Make sure you have no other crate creating wakers other than `embassy-executor`. These will panic at runtime.
Note that the patched `core` is equivalent to the unpached one when the `turbowakers` feature is not enabled, so it should be fine to leave it there.
2023-03-30 17:55:55 +02:00
Dario Nieuwenhuis
2c45b5c519
sync/pipe: update to clarify docs that it is byte-oriented.
...
There was some language copypasted from Channel talking about "messages"
or "values", that is not really accurate with Pipe.
2023-03-26 23:32:12 +02:00
Rasmus Melchior Jacobsen
ce7bd6955f
perf(pubsub): Skip clone on last message
2023-03-21 13:25:49 +01:00
Rasmus Melchior Jacobsen
472df3fad6
fix(pubsub): Pop messages which count is 0 after unsubscribe
2023-03-15 16:45:18 +01:00
Grant Miller
7be4337de9
Add #[must_use]
to all futures
2023-02-24 13:01:41 -06:00
Dario Nieuwenhuis
10c9cc31b1
Remove unnecessary use of atomic-polyfill.
...
Only use it when CAS is actually needed.
2022-12-23 20:46:49 +01:00
Gabriel Smith
d438d1b685
sync: Fix nightly feature compilation after upgrade to embedded-io 0.4.0
2022-11-27 16:24:20 -05:00
Dario Nieuwenhuis
1e2fb0459d
Switch to async-fn-in-trait
2022-11-25 21:02:06 +01:00
Matt Johnston
536b6a2de5
sync/signal: Implement Default for Signal
2022-11-22 21:55:42 +08:00
Matt Johnston
14a2d15240
Derive Default for WakerRegistration
...
This simplifies creating arrays of WakerRegistrations
2022-11-06 11:33:38 +08:00
Dario Nieuwenhuis
d2246ae693
Release embassy-sync, embassy-time v0.1.0
2022-10-26 22:13:27 +02:00
Dario Nieuwenhuis
eeb072d9cb
Update Rust nightly.
2022-10-26 16:47:29 +02:00
Dion Dokter
530182d668
Forgot to add space function to immediate publisher
2022-10-05 15:15:03 +02:00
Ulf Lilleengen
59765590e0
Add required info to embassy-sync package
...
Updates the README.md based on embassy-futures structure.
2022-10-04 16:38:11 +02:00
Dion Dokter
874384826d
Went back to named futures but now with must_use
2022-09-29 15:15:10 +02:00
Dion Dokter
f4ebc36b63
Futures in pub & sub are now awaited instead of returned for better user compiler diagnostics.
...
Added functions for reading how many messages are available
2022-09-29 14:24:42 +02:00
ivmarkov
c5ce02b30e
Remove default, reorder generic params
2022-09-25 09:40:36 +03:00
ivmarkov
8536666148
Remove default, reorder generic params
2022-09-24 20:27:27 +03:00
ivmarkov
ca92302d03
Parameterize Signal with RawMutex
2022-09-24 20:26:51 +03:00
Dario Nieuwenhuis
a0487380da
Replace futures::future::poll_fn -> core::future::poll_fn.
2022-09-22 16:42:49 +02:00
Dario Nieuwenhuis
897b72c872
Update Rust nightly.
...
Removes feature(generic_associated_types)
2022-09-22 16:38:14 +02:00
Joakim Hulthe
79654510b7
Make rustfmt happy
2022-09-16 10:45:01 +02:00
Joakim Hulthe
70a3b85acc
Add .into_inner() and .get_mut() to Mutex
2022-09-16 10:32:43 +02:00
Dario Nieuwenhuis
ea5f2c71e0
sync/signal: wake old waker on overflow instead of panicking.
...
This makes behavior consistent with `WakerRegistration`. It allows canceling `wait`
in one task and then calling `wait` in another. If two tasks are `wait`ing
concurrently the signal will be received by only one of them, randomly.
2022-09-12 12:05:58 +02:00