DASH  0.3.0
Synchronization primitives for mutual exclusion of units.

Synchronization primitives for mutual exclusion of units. More...

Collaboration diagram for Synchronization primitives for mutual exclusion of units.:

Typedefs

typedef struct dart_lock_struct * dart_lock_t
 Lock type to ensure mutual exclusion among units in a team. More...
 

Functions

dart_ret_t dart_team_lock_init (dart_team_t teamid, dart_lock_t *lock)
 Collective operation to initialize the lock object. More...
 
dart_ret_t dart_team_lock_destroy (dart_lock_t *lock)
 Collective operation to destroy a lock initialized using dart_team_lock_init. More...
 
dart_ret_t dart_lock_acquire (dart_lock_t lock)
 Block until the lock was acquired. More...
 
dart_ret_t dart_lock_try_acquire (dart_lock_t lock, int32_t *result)
 Try to acquire the lock and return immediately. More...
 
dart_ret_t dart_lock_release (dart_lock_t lock)
 Release the lock acquired through dart_lock_acquire or dart_lock_try_acquire. More...
 

Detailed Description

Synchronization primitives for mutual exclusion of units.

Typedef Documentation

◆ dart_lock_t

typedef struct dart_lock_struct* dart_lock_t

#include </tmp/tmporruphar/dart-if/include/dash/dart/if/dart_synchronization.h>

Lock type to ensure mutual exclusion among units in a team.

The lock is thread-aware so only one thread of a unit can acquire the lock at once.

Definition at line 30 of file dart_synchronization.h.

Function Documentation

◆ dart_lock_acquire()

dart_ret_t dart_lock_acquire ( dart_lock_t  lock)

#include </tmp/tmporruphar/dart-if/include/dash/dart/if/dart_synchronization.h>

Block until the lock was acquired.

The lock can be held by any thread in any unit of the team.

Note that the lock is not recursive, trying to acquire the lock twice in the same thread is erroneous.

Parameters
lockThe lock to acquire
Returns
DART_OK on sucess or an error code from dart_ret_t otherwise.
Thread safety
This function is safe to be called by multiple threads in parallel.

◆ dart_lock_release()

dart_ret_t dart_lock_release ( dart_lock_t  lock)

#include </tmp/tmporruphar/dart-if/include/dash/dart/if/dart_synchronization.h>

Release the lock acquired through dart_lock_acquire or dart_lock_try_acquire.

Parameters
lockThe lock to release.
Returns
DART_OK on sucess or an error code from dart_ret_t otherwise.
Thread safety
This function is safe to be called by multiple threads in parallel.

◆ dart_lock_try_acquire()

dart_ret_t dart_lock_try_acquire ( dart_lock_t  lock,
int32_t *  result 
)

#include </tmp/tmporruphar/dart-if/include/dash/dart/if/dart_synchronization.h>

Try to acquire the lock and return immediately.

Note that the lock is not recursive, trying to acquire the lock twice in the same thread is erroneous.

Parameters
lockThe lock to acquire
[out]resultTrue if the lock was successfully acquired, false otherwise.
Returns
DART_OK on success or an error code from dart_ret_t otherwise.
Thread safety
This function is safe to be called by multiple threads in parallel.

◆ dart_team_lock_destroy()

dart_ret_t dart_team_lock_destroy ( dart_lock_t lock)

#include </tmp/tmporruphar/dart-if/include/dash/dart/if/dart_synchronization.h>

Collective operation to destroy a lock initialized using dart_team_lock_init.

Parameters
lockThe lock to free.
Returns
DART_OK on sucess or an error code from dart_ret_t otherwise.
Thread safety
This function is not thread-safe.

◆ dart_team_lock_init()

dart_ret_t dart_team_lock_init ( dart_team_t  teamid,
dart_lock_t lock 
)

#include </tmp/tmporruphar/dart-if/include/dash/dart/if/dart_synchronization.h>

Collective operation to initialize the lock object.

Parameters
teamidTeam this lock is used for.
lockThe lock to initialize.
Returns
DART_OK on sucess or an error code from dart_ret_t otherwise.
Thread safety
This function is not thread-safe.