mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
This is useful for static locals that never need to be destroyed:
Thing& Thing::the()
{
static Eternal<Thing> the;
return the;
}
The object will be allocated in data segment memory and will never have
its destructor invoked.
23 lines
453 B
C++
23 lines
453 B
C++
#include <Kernel/Net/LoopbackAdapter.h>
|
|
#include <AK/Eternal.h>
|
|
|
|
LoopbackAdapter& LoopbackAdapter::the()
|
|
{
|
|
static Eternal<LoopbackAdapter> the;
|
|
return the;
|
|
}
|
|
|
|
LoopbackAdapter::LoopbackAdapter()
|
|
{
|
|
set_ipv4_address({ 127, 0, 0, 1 });
|
|
}
|
|
|
|
LoopbackAdapter::~LoopbackAdapter()
|
|
{
|
|
}
|
|
|
|
void LoopbackAdapter::send_raw(const byte* data, int size)
|
|
{
|
|
dbgprintf("LoopbackAdapter: Sending %d byte(s) to myself.\n", size);
|
|
did_receive(data, size);
|
|
}
|