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

Commit

Permalink
begin to deprecate Mutex.lock_nothrow/unlock_nothrow
Browse files Browse the repository at this point in the history
- replace with alias to lock/unlock which are now nothrow
  • Loading branch information
MartinNowak committed Jan 13, 2015
1 parent 097bb6f commit 1eaf506
Showing 1 changed file with 10 additions and 21 deletions.
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

0 comments on commit 1eaf506

Please sign in to comment.