Legion Runtime
Public Member Functions | Protected Member Functions | List of all members
Legion::Lock Class Reference

#include <legion.h>

Public Member Functions

bool operator< (const Lock &rhs) const
 
bool operator== (const Lock &rhs) const
 
void acquire (unsigned mode=0, bool exclusive=true)
 
void release (void)
 

Protected Member Functions

FRIEND_ALL_RUNTIME_CLASSES Lock (Reservation r)
 

Detailed Description

NOTE THIS IS NOT A NORMAL LOCK! A lock is an atomicity mechanism for use with regions acquired with simultaneous coherence in a deferred execution model.
Locks are light-weight handles that are created in a parent task and can be passed to child tasks to guaranteeing atomic access to a region in simultaneous mode. Lock can be used to request access in either exclusive (mode 0) or non-exclusive mode (any number other than zero). Non-exclusive modes are mutually-exclusive from each other. While locks can be passed down the task tree, they should never escape the context in which they are created as they will be garbage collected when the task in which they were created is complete.

There are two ways to use locks. The first is to use the blocking acquire and release methods on the lock directly. Acquire guarantees that the application will hold the lock when it returns, but may result in stalls while some other task is holding the lock. The recommended way of using locks is to request grants of a lock through the runtime interface and then pass grants to launcher objects. This ensures that the lock will be held during the course of the operation while still avoiding any stalls in the task's execution.

See also
TaskLauncher
IndexTaskLauncher
CopyLauncher
InlineLauncher
Runtime

The documentation for this class was generated from the following file: