1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

Kernel: Allow passing a thread argument for new kernel threads

This adds the ability to pass a pointer to kernel thread/process.
Also add the ability to use a closure as thread function, which
allows passing information to a kernel thread more easily.
This commit is contained in:
Tom 2020-11-16 20:51:34 -07:00 committed by Andreas Kling
parent 6cb640eeba
commit 6a620562cc
11 changed files with 68 additions and 24 deletions

View file

@ -57,15 +57,15 @@ static void handle_icmp(const EthernetFrameHeader&, const IPv4Packet&, const tim
static void handle_udp(const IPv4Packet&, const timeval& packet_timestamp);
static void handle_tcp(const IPv4Packet&, const timeval& packet_timestamp);
[[noreturn]] static void NetworkTask_main();
[[noreturn]] static void NetworkTask_main(void*);
void NetworkTask::spawn()
{
RefPtr<Thread> thread;
Process::create_kernel_process(thread, "NetworkTask", NetworkTask_main);
Process::create_kernel_process(thread, "NetworkTask", NetworkTask_main, nullptr);
}
void NetworkTask_main()
void NetworkTask_main(void*)
{
WaitQueue packet_wait_queue;
u8 octet = 15;