Skip to content

Commit

Permalink
Merge tag v4.4.5 into v4.5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-wende-sociomantic committed Mar 22, 2019
2 parents 677bbf8 + 031488f commit 5f381c2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/ocean/io/select/protocol/generic/ErrnoIOException.d
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class IOError : IOWarning

class SocketError : IOError
{
import ocean.sys.socket.model.ISocket : ISelectable;
import ocean.io.device.Conduit : ISelectable;
import ocean.sys.socket.model.ISocket;

/**************************************************************************
Expand Down
47 changes: 32 additions & 15 deletions src/ocean/util/container/cache/model/containers/KeyToNode.d
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class KeyToNode: HashMap!(TimeToIndex.Node*)
/***************************************************************************
Bucket elements allocator.
The elements are allocated only during container construction,
and never freed.
***************************************************************************/

Expand All @@ -85,22 +87,37 @@ class KeyToNode: HashMap!(TimeToIndex.Node*)

public this ( size_t n )
{
super(this.allocator = new ArrayAllocatedFreeBucketElements(n), n);
this.allocator = new ArrayAllocatedFreeBucketElements(n);
super(this.allocator, n);
}
}

/***************************************************************************
Removes all elements from all buckets.
Returns:
this instance
**************************************************************************/
unittest
{
KeyToNode map = new KeyToNode(5);
(*map.put(1)) = new TimeToIndex.Node();
(*map.put(2)) = new TimeToIndex.Node();
(*map.put(3)) = new TimeToIndex.Node();
(*map.put(4)) = new TimeToIndex.Node();
(*map.put(5)) = new TimeToIndex.Node();
map.clear();
map.clear();
map.clear();
}

public override typeof(this) clear ( )
{
super.clear();
this.allocator.pool.clear();
return this;
}
unittest
{
KeyToNode map = new KeyToNode(100000);
map.clear();
map.put(9207674216414740734);
map.put(8595442437537477107);
map.clear();
map.put(8595442437537477107);
map.clear();
map.put(9207674216414740734);
map.put(8595442437537477106);
map.put(8595442437537477108);
map.put(8595442437537477110);
map.put(8595442437537477112);
map.clear();
}

0 comments on commit 5f381c2

Please sign in to comment.