Loop.maxEvents is const, not inout const
This commit is contained in:
parent
cb6cc65113
commit
8ddea0aa46
@ -46,7 +46,7 @@ class EpollLoop : SelectorLoop
|
||||
{
|
||||
if ((fd = epoll_create1(EPOLL_CLOEXEC)) < 0)
|
||||
{
|
||||
throw MmapPool.instance.make!BadLoopException("epoll initialization failed");
|
||||
throw defaultAllocator.make!BadLoopException("epoll initialization failed");
|
||||
}
|
||||
super();
|
||||
events = Vector!epoll_event(maxEvents, MmapPool.instance);
|
||||
|
@ -124,8 +124,8 @@ class KqueueLoop : SelectorLoop
|
||||
* Returns: Maximal event count can be got at a time
|
||||
* (should be supported by the backend).
|
||||
*/
|
||||
override protected @property inout(uint) maxEvents()
|
||||
inout const pure nothrow @safe @nogc
|
||||
override protected @property uint maxEvents()
|
||||
const pure nothrow @safe @nogc
|
||||
{
|
||||
return cast(uint) events.length;
|
||||
}
|
||||
@ -158,12 +158,12 @@ class KqueueLoop : SelectorLoop
|
||||
changes.length = changeCount + maxEvents;
|
||||
}
|
||||
EV_SET(&changes[changeCount],
|
||||
cast(ulong) socket,
|
||||
filter,
|
||||
flags,
|
||||
0U,
|
||||
0L,
|
||||
null);
|
||||
cast(ulong) socket,
|
||||
filter,
|
||||
flags,
|
||||
0U,
|
||||
0L,
|
||||
null);
|
||||
++changeCount;
|
||||
}
|
||||
|
||||
|
@ -137,8 +137,8 @@ abstract class Loop
|
||||
* Returns: Maximal event count can be got at a time
|
||||
* (should be supported by the backend).
|
||||
*/
|
||||
protected @property inout(uint) maxEvents()
|
||||
inout const pure nothrow @safe @nogc
|
||||
protected @property uint maxEvents()
|
||||
const pure nothrow @safe @nogc
|
||||
{
|
||||
return 128U;
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ struct ReadBuffer(T = ubyte)
|
||||
numberRead = fillBuffer(b[], b.free, 0, 10);
|
||||
b += numberRead;
|
||||
|
||||
result = b[0..$];
|
||||
result = b[0 .. $];
|
||||
assert(result[0] == 0);
|
||||
assert(result[1] == 1);
|
||||
assert(result[9] == 9);
|
||||
@ -261,7 +261,6 @@ struct ReadBuffer(T = ubyte)
|
||||
allocator.reallocate(buf, (cap + blockSize) * T.sizeof);
|
||||
buffer_ = cast(T[]) buf;
|
||||
}();
|
||||
buffer_[cap .. $] = T.init;
|
||||
}
|
||||
ring = length_;
|
||||
return buffer_[length_ .. $];
|
||||
@ -280,7 +279,7 @@ struct ReadBuffer(T = ubyte)
|
||||
b += numberRead;
|
||||
|
||||
assert(b.length == 10);
|
||||
result = b[0..$];
|
||||
result = b[0 .. $];
|
||||
assert(result[0] == 0);
|
||||
assert(result[9] == 9);
|
||||
b.clear();
|
||||
@ -337,33 +336,25 @@ struct WriteBuffer(T = ubyte)
|
||||
* size = Initial buffer size and the size by which the buffer will
|
||||
* grow.
|
||||
* allocator = Allocator.
|
||||
*
|
||||
* Precondition: $(D_INLINECODE size > 0 && allocator !is null)
|
||||
*/
|
||||
this(in size_t size, shared Allocator allocator = defaultAllocator) @trusted
|
||||
in
|
||||
{
|
||||
assert(size > 0);
|
||||
assert(allocator !is null);
|
||||
}
|
||||
body
|
||||
{
|
||||
blockSize = size;
|
||||
ring = size - 1;
|
||||
this(allocator);
|
||||
allocator_ = allocator;
|
||||
buffer_ = cast(T[]) allocator_.allocate(size * T.sizeof);
|
||||
}
|
||||
|
||||
@disable this();
|
||||
|
||||
/// Ditto.
|
||||
this(shared Allocator allocator)
|
||||
in
|
||||
{
|
||||
assert(allocator !is null);
|
||||
}
|
||||
body
|
||||
{
|
||||
allocator_ = allocator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deallocates the internal buffer.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user