View source code
							
							
						
								Display the source code in core/sync/mutex.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						Class core.sync.mutex.Mutex
This class represents a general purpose, recursive mutex.
						
				class Mutex
				
  : object
				Implemented using pthread_mutex on Posix and CRITICAL_SECTION
 on Windows.
Constructors
| Name | Description | 
|---|---|
| this | Initializes a mutex object. | 
| this | Initializes a mutex object and sets it as the monitor for obj. | 
Methods
| Name | Description | 
|---|---|
| lock | If this lock is not already held by the caller, the lock is acquired, then the internal counter is incremented by one. | 
| lock_nothrow | If this lock is not already held by the caller, the lock is acquired, then the internal counter is incremented by one. | 
| tryLock | 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 counter is incremented by one. | 
| tryLock_nothrow | 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 counter is incremented by one. | 
| unlock | Decrements the internal lock count by one. If this brings the count to zero, the lock is released. | 
| unlock_nothrow | Decrements the internal lock count by one. If this brings the count to zero, the lock is released. | 
| factory | Create instance of class specified by the fully qualified name classname. The class must either have no constructors or have a default constructor. | 
| opCmp | Compare with another Object obj. | 
| opEquals | Test whether thisis equal too.
 The default implementation only compares by identity (using theisoperator).
 Generally, overrides foropEqualsshould attempt to compare objects by their contents. | 
| toHash | Compute hash function for Object. | 
| toString | Convert Object to a human readable string. | 
Example
import coreAuthors
Sean Kelly
License
					Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.