ARGOBOTS  8bef54a19d7b3e50f977f85716578b627bf37d9c
Typedefs | Functions
Mutex Attributes

This group is for Mutex Attributes. Mutex attributes are used to specify mutex behavior that is different from the default. More...

Typedefs

typedef struct ABT_mutex_attr_opaque * ABT_mutex_attr
 Mutex attribute handle type. More...
 

Functions

int ABT_mutex_attr_create (ABT_mutex_attr *newattr)
 Create a new mutex attribute. More...
 
int ABT_mutex_attr_free (ABT_mutex_attr *attr)
 Free a mutex attribute. More...
 
int ABT_mutex_attr_set_recursive (ABT_mutex_attr attr, ABT_bool recursive)
 Set a recursive property in a mutex attribute. More...
 
int ABT_mutex_attr_get_recursive (ABT_mutex_attr attr, ABT_bool *recursive)
 Get a recursive property in a mutex attribute. More...
 

Detailed Description

This group is for Mutex Attributes. Mutex attributes are used to specify mutex behavior that is different from the default.

Typedef Documentation

◆ ABT_mutex_attr

typedef struct ABT_mutex_attr_opaque* ABT_mutex_attr

Mutex attribute handle type.

A NULL handle of this type is ABT_MUTEX_ATTR_NULL.

Definition at line 952 of file abt.h.

Function Documentation

◆ ABT_mutex_attr_create()

int ABT_mutex_attr_create ( ABT_mutex_attr newattr)

Create a new mutex attribute.

ABT_mutex_attr_create() creates a new mutex attribute with default attribute values and returns its handle through newattr.

The default parameters are as follows:

  • Not recursive.

newattr must be freed by ABT_mutex_attr_free() after its use.

Execution context
This routine can be called in any execution context. Argobots must be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_MEM is returned if memory allocation fails.
ABT_ERR_SYS is returned if an error related to system calls and standard libraries occurs.
Undefined behavior
If Argobots is not initialized, the results are undefined.
If newattr is NULL, the results are undefined.
Parameters
[out]newattrmutex attribute handle
Returns
Error code

Definition at line 39 of file mutex_attr.c.

◆ ABT_mutex_attr_free()

int ABT_mutex_attr_free ( ABT_mutex_attr attr)

Free a mutex attribute.

ABT_mutex_attr_free() deallocates the resource used for the mutex attribute attr and sets attr to ABT_MUTEX_ATTR_NULL.

Execution context
This routine can be called in any execution context. Argobots must be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_INV_MUTEX_ATTR is returned if attr points to ABT_MUTEX_ATTR_NULL.
Undefined behavior
If Argobots is not initialized, the results are undefined.
If attr is NULL, the results are undefined.
If attr is accessed after calling this routine, the results are undefined.
Parameters
[in,out]attrmutex attribute handle
Returns
Error code

Definition at line 79 of file mutex_attr.c.

◆ ABT_mutex_attr_get_recursive()

int ABT_mutex_attr_get_recursive ( ABT_mutex_attr  attr,
ABT_bool recursive 
)

Get a recursive property in a mutex attribute.

ABT_mutex_attr_get_recursive() retrieves the recursive property (i.e., whether the mutex can be locked multiple times by the same owner or not) in the mutex attribute attr. If attr is configured to be recursive, recursive is set to ABT_TRUE. Otherwise, recursive is set to ABT_FALSE.

Execution context
This routine can be called in any execution context. Argobots must be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_INV_MUTEX_ATTR is returned if attr is ABT_MUTEX_ATTR_NULL.
Undefined behavior
If Argobots is not initialized, the results are undefined.
If recursive is NULL, the results are undefined.
Parameters
[in]attrmutex attribute handle
[in]recursiveflag for a recursive locking support
Returns
Error code

Definition at line 162 of file mutex_attr.c.

◆ ABT_mutex_attr_set_recursive()

int ABT_mutex_attr_set_recursive ( ABT_mutex_attr  attr,
ABT_bool  recursive 
)

Set a recursive property in a mutex attribute.

ABT_mutex_attr_set_recursive() sets the recursive property (i.e., whether the mutex can be locked multiple times by the same owner or not) in the mutex attribute attr. If recursive is ABT_TRUE, the recursive flag of attr is set. Otherwise, the recursive flag of attr is unset.

Execution context
This routine can be called in any execution context. Argobots must be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
ABT_ERR_INV_MUTEX_ATTR is returned if attr is ABT_MUTEX_ATTR_NULL.
Undefined behavior
If Argobots is not initialized, the results are undefined.
If recursive is neither ABT_TRUE nor ABT_FALSE, the results are undefined.
If attr is accessed concurrently, the results are undefined.
Parameters
[in]attrmutex attribute handle
[in]recursiveflag for a recursive locking support
Returns
Error code

Definition at line 120 of file mutex_attr.c.