Skip to content
Snippets Groups Projects
Commit a19c3fda authored by Nadav Har'El's avatar Nadav Har'El Committed by Pekka Enberg
Browse files

Convenience attr constructor for a thread with a small stack


Our sched::thread makes it rather difficult to create threads with
non-default attributes. This patch makes it easier to create a thread
with a non-default stack size, e.g., a light thread with a one-page stack:

   sched::thread a([&] { func(); }, sched::thread::attr(4096))

We should probably overhaul the sched::thread constructors at some
point to make it easier to specify options, but for now, this
specific constructor is convenient for my uses.

Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 7a7bfb82
No related branches found
No related tags found
No related merge requests found
......@@ -282,6 +282,7 @@ public:
cpu *pinned_cpu;
bool detached = false;
attr(cpu *pinned_cpu = nullptr) : pinned_cpu(pinned_cpu) { }
attr(size_t stacksize) : stack(nullptr, stacksize), pinned_cpu(nullptr) { }
};
private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment