Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
make __setArrayAllocLength pure nothrow
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowak committed Apr 11, 2014
1 parent ebee7fd commit 0b30e34
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/rt/lifetime.d
Expand Up @@ -198,7 +198,7 @@ private class ArrayAllocLengthLock
where elem0 starts 16 bytes after the first byte.
*/
bool __setArrayAllocLength(ref BlkInfo info, size_t newlength, bool isshared, size_t oldlength = ~0)
bool __setArrayAllocLength(ref BlkInfo info, size_t newlength, bool isshared, size_t oldlength = ~0) pure nothrow
{
if(info.size <= 256)
{
Expand All @@ -210,13 +210,15 @@ bool __setArrayAllocLength(ref BlkInfo info, size_t newlength, bool isshared, si
{
if(isshared)
{
synchronized(typeid(ArrayAllocLengthLock))
try synchronized(typeid(ArrayAllocLengthLock))
{
if(*length == cast(ubyte)oldlength)
*length = cast(ubyte)newlength;
else
return false;
}
catch (Throwable t)
assert(0, "Failed to synchronize.");
}
else
{
Expand All @@ -242,13 +244,15 @@ bool __setArrayAllocLength(ref BlkInfo info, size_t newlength, bool isshared, si
{
if(isshared)
{
synchronized(typeid(ArrayAllocLengthLock))
try synchronized(typeid(ArrayAllocLengthLock))
{
if(*length == oldlength)
*length = cast(ushort)newlength;
else
return false;
}
catch (Throwable t)
assert(0, "Failed to synchronize.");
}
else
{
Expand All @@ -274,13 +278,15 @@ bool __setArrayAllocLength(ref BlkInfo info, size_t newlength, bool isshared, si
{
if(isshared)
{
synchronized(typeid(ArrayAllocLengthLock))
try synchronized(typeid(ArrayAllocLengthLock))
{
if(*length == oldlength)
*length = newlength;
else
return false;
}
catch (Throwable t)
assert(0, "Failed to synchronize.");
}
else
{
Expand Down

0 comments on commit 0b30e34

Please sign in to comment.