1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:27:35 +00:00

Kernel: Add a NetworkTask and a received network packet queue.

It will be easier to deal with incoming packets in a separate task.
This commit is contained in:
Andreas Kling 2019-03-11 12:43:45 +01:00
parent 47b096feb4
commit 35098cbde1
10 changed files with 90 additions and 11 deletions

View file

@ -1,6 +1,6 @@
#pragma once
#include <utility>
#include "StdLibExtras.h"
namespace AK {
@ -35,9 +35,19 @@ public:
T& last() { ASSERT(head()); return tail()->value; }
const T& last() const { ASSERT(head()); return tail()->value; }
T take_first()
{
ASSERT(head());
T value = first();
if (m_tail == m_head)
m_tail = nullptr;
m_head = m_head->next;
return value;
}
void append(T&& value)
{
auto* node = new Node(std::move(value));
auto* node = new Node(move(value));
if (!m_head) {
m_head = node;
m_tail = node;