Use std.experimental.allocator and remove the custom allocator module.

This commit is contained in:
Sönke Ludwig 2016-11-08 15:32:25 +01:00
parent 55a06c30f3
commit f74c30a9f3
9 changed files with 278 additions and 915 deletions

View file

@ -17,7 +17,6 @@ import std.typetuple;
import std.variant;
import std.string;
import vibe.core.task;
//import vibe.utils.memory;
public import std.concurrency;
@ -1075,7 +1074,7 @@ template isCopyable(T)
value.
*/
struct Future(T) {
import vibe.internal.memory : FreeListRef;
import vibe.internal.freelistref : FreeListRef;
private {
FreeListRef!(shared(T)) m_result;
@ -1129,7 +1128,7 @@ Future!(ReturnType!CALLABLE) async(CALLABLE, ARGS...)(CALLABLE callable, ARGS ar
if (is(typeof(callable(args)) == ReturnType!CALLABLE))
{
import vibe.core.core;
import vibe.internal.memory : FreeListRef;
import vibe.internal.freelistref : FreeListRef;
import std.functional : toDelegate;
alias RET = ReturnType!CALLABLE;

View file

@ -11,7 +11,7 @@ import vibe.core.log;
import core.thread;
import vibe.core.sync;
import vibe.internal.memory;
import vibe.internal.freelistref;
/**
Generic connection pool class.

View file

@ -122,11 +122,12 @@ interface OutputStream {
protected final void writeDefault(InputStream stream, ulong nbytes = 0)
@trusted // FreeListRef
{
import vibe.internal.memory : FreeListRef;
import vibe.internal.allocator : theAllocator, make, dispose;
static struct Buffer { ubyte[64*1024] bytes = void; }
auto bufferobj = FreeListRef!(Buffer, false)();
auto buffer = bufferobj.bytes[];
auto bufferobj = theAllocator.make!Buffer();
scope (exit) theAllocator.dispose(bufferobj);
auto buffer = bufferobj.bytes;
//logTrace("default write %d bytes, empty=%s", nbytes, stream.empty);
if( nbytes == 0 ){