Showing with 10 additions and 21 deletions.
  1. +10 −21 src/core/sync/mutex.d
31 changes: 10 additions & 21 deletions src/core/sync/mutex.d
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,6 @@ nothrow:
* SyncError on error.
*/
@trusted void lock()
{
lock_impl!SyncError();
}

@trusted void lock_nothrow() nothrow
{
lock_impl!Error();
}
private @trusted void lock_impl(Exc)()
{
version( Windows )
{
Expand All @@ -148,10 +139,14 @@ nothrow:
{
int rc = pthread_mutex_lock( &m_hndl );
if( rc )
throw new Exc( "Unable to lock mutex" );
throw new SyncError( "Unable to lock mutex" );
}
}

// TBD in 2.067
// deprecated("Please use lock instead")
alias lock_nothrow = lock;

/**
* Decrements the internal lock count by one. If this brings the count to
* zero, the lock is released.
Expand All @@ -160,16 +155,6 @@ nothrow:
* SyncError on error.
*/
@trusted void unlock()
{
unlock_impl!SyncError();
}

@trusted void unlock_nothrow() nothrow
{
unlock_impl!Error();
}

private @trusted void unlock_impl(Exc)()
{
version( Windows )
{
Expand All @@ -179,10 +164,14 @@ nothrow:
{
int rc = pthread_mutex_unlock( &m_hndl );
if( rc )
throw new Exc( "Unable to unlock mutex" );
throw new SyncError( "Unable to unlock mutex" );
}
}

// TBD in 2.067
// deprecated("Please use unlock instead")
alias unlock_nothrow = unlock;

/**
* If the lock is held by another caller, the method returns. Otherwise,
* the lock is acquired if it is not already held, and then the internal
Expand Down