util/HugeAllocator: move MADV_DONTFORK setting to HugeForkCow()
Enforcing MADV_DONTFORK is a surprising limitation for this library which aims to be generic.
This commit is contained in:
@@ -38,7 +38,10 @@ AsyncInputStream::AsyncInputStream(EventLoop &event_loop, const char *_url,
|
||||
deferred_seek(event_loop, BIND_THIS_METHOD(DeferredSeek)),
|
||||
allocation(_buffer_size),
|
||||
buffer((uint8_t *)allocation.get(), _buffer_size),
|
||||
resume_at(_resume_at) {}
|
||||
resume_at(_resume_at)
|
||||
{
|
||||
allocation.ForkCow(false);
|
||||
}
|
||||
|
||||
AsyncInputStream::~AsyncInputStream()
|
||||
{
|
||||
|
@@ -53,6 +53,8 @@ ThreadInputStream::Start()
|
||||
void *p = HugeAllocate(buffer_size);
|
||||
assert(p != nullptr);
|
||||
|
||||
HugeForkCow(p, buffer_size, false);
|
||||
|
||||
buffer = new CircularBuffer<uint8_t>((uint8_t *)p, buffer_size);
|
||||
thread.Start();
|
||||
}
|
||||
|
Reference in New Issue
Block a user