Re: [PATCH v2 4/8] rust: workqueue: define built-in queues

From: Martin Rodriguez Reboredo
Date: Thu Jun 01 2023 - 13:52:40 EST


On 6/1/23 14:30, Gary Guo wrote:
On Thu, 1 Jun 2023 13:49:42 +0000
Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:

From: Wedson Almeida Filho <walmeida@xxxxxxxxxxxxx>

We provide these methods because it lets us access these queues from
Rust without using unsafe code.

These methods return `&'static Queue`. References annotated with the
'static lifetime are used when the referent will stay alive forever.
That is ok for these queues because they are global variables and cannot
be destroyed.

Signed-off-by: Wedson Almeida Filho <walmeida@xxxxxxxxxxxxx>
Co-developed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@xxxxxxxxx>

This looks fine to me, so:

Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>

Just one question about style: would people prefer:

kernel::workqueue::system().enqueue(...)

or

use kernel::workqueue::Queue;
Queue::system().enqueue(...)

?

I can compare the first with `std::thread::spawn` and the second
with enqueuing an executor with a future. Both makes sense to me so
I can't decide.

[...]