mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:17: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:
parent
47b096feb4
commit
35098cbde1
10 changed files with 90 additions and 11 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue