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

Support for Zephyr kernel objects #5

Merged
merged 26 commits into from
Oct 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bacd922
zephyr: sys::sync: move semaphores into their own module
d3zd3z Oct 15, 2024
c0434a2
zephyr: kobj_define: Add sys Mutex and sys Condvar
d3zd3z Oct 15, 2024
4d4ee9b
zephyr: sys: sync: Mutex: Implement Send/Sync
d3zd3z Oct 15, 2024
2731deb
samples: philosophers: Add sysmutex version
d3zd3z Oct 15, 2024
102478e
zephyr: sync: Create Mutex/Condvar
d3zd3z Oct 15, 2024
2a8a82d
samples: philosophers: Add sync using Mutex/Condvar
d3zd3z Oct 15, 2024
1c8d82a
zephyr: sys: Create queue type based on k_queue
d3zd3z Oct 15, 2024
9187024
zephyr: sync: channel: Create unbounded channels
d3zd3z Oct 15, 2024
1e62073
samples: philosophers: Add implementation for channels
d3zd3z Oct 15, 2024
099aaa7
samples: philosophers: Add statistics
d3zd3z Oct 16, 2024
2413a53
zephyr: Remove 'unsafe' from sys::Mutex::unlock
d3zd3z Oct 17, 2024
2717d8b
zephyr: sync: Remove unsafe block from unlock
d3zd3z Oct 17, 2024
93448bf
zephyr: object: Make StaticKernelObject::new unsafe
d3zd3z Oct 17, 2024
058740f
zephyr: object: Reorder declarations
d3zd3z Oct 17, 2024
43c0c8a
zephyr: sys: sync: Remove Clone from Mutex and Semaphore
d3zd3z Oct 21, 2024
aaad7ee
zephry: object: Create Fixed concept
d3zd3z Oct 24, 2024
fba3393
zephyr: sys: sync: sempahore: Add dynamic support
d3zd3z Oct 24, 2024
ad0924d
samples: philosophers: Add dynamic semaphore example
d3zd3z Oct 24, 2024
8cdf4a6
zephyr: sys: sync: Add Mutex::new()
d3zd3z Oct 24, 2024
56f1d31
samples: philosophers: Change sys::Mutex to dynamic
d3zd3z Oct 24, 2024
4850c4d
zephyr: sys: queue: Add Queue::new()
d3zd3z Oct 24, 2024
f12e568
zephyr: sync: channel: Fully dynamically allocated
d3zd3z Oct 24, 2024
150ec35
samples: philosophers: Convert channel sync to dynamic
d3zd3z Oct 24, 2024
70e2710
zephyr: sync: Add Mutex::new and Condvar::new
d3zd3z Oct 24, 2024
7758fe5
samples: philosophers: Switch condsync to dynamic
d3zd3z Oct 24, 2024
d78650f
CI: Clean up the work the CI build does
d3zd3z Oct 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
samples: philosophers: Convert channel sync to dynamic
Use the new dynamically allocated Channels to simplify the code.

Signed-off-by: David Brown <david.brown@linaro.org>
d3zd3z committed Oct 24, 2024
commit 150ec35784bd121ba1bff75b4c5b2eadebd92737
12 changes: 3 additions & 9 deletions samples/philosophers/src/channel.rs
Original file line number Diff line number Diff line change
@@ -112,10 +112,9 @@ impl ChannelSync {
/// Generate a syncer out of a ChannelSync.
#[allow(dead_code)]
pub fn get_channel_syncer() -> Vec<Arc<dyn ForkSync>> {
let command_queue = COMMAND_QUEUE.init_once(()).unwrap();
let (cq_send, cq_recv) = channel::unbounded_from(command_queue);
let reply_queues = REPLY_QUEUES.each_ref().map(|m| {
channel::unbounded_from(m.init_once(()).unwrap())
let (cq_send, cq_recv) = channel::unbounded();
let reply_queues = [(); NUM_PHIL].each_ref().map(|()| {
channel::unbounded()
});
let syncer = reply_queues.into_iter().map(|rqueue| {
let item = Box::new(ChannelSync::new(cq_send.clone(), rqueue))
@@ -165,9 +164,4 @@ impl ForkSync for ChannelSync {
kobj_define! {
static CHANNEL_STACK: ThreadStack<2054>;
static CHANNEL_THREAD: StaticThread;

// For communicating using Queue, there is one to the main thread (the manager), and one back
// to each philosopher.
static COMMAND_QUEUE: StaticQueue;
static REPLY_QUEUES: [StaticQueue; NUM_PHIL];
}