ARGOBOTS
Functions
Eventual

Functions

int ABT_eventual_create (int nbytes, ABT_eventual *neweventual)
 Create an eventual. More...
 
int ABT_eventual_free (ABT_eventual *eventual)
 Free the eventual object. More...
 
int ABT_eventual_wait (ABT_eventual eventual, void **value)
 Wait on the eventual. More...
 
int ABT_eventual_test (ABT_eventual eventual, void **value, int *is_ready)
 Test the readiness of an eventual. More...
 
int ABT_eventual_set (ABT_eventual eventual, void *value, int nbytes)
 Signal the eventual. More...
 
int ABT_eventual_reset (ABT_eventual eventual)
 Reset the readiness of the target eventual. More...
 

Detailed Description

In Argobots, an eventual corresponds to the traditional behavior of the future concept (refer to Future). A ULT creates an eventual, which is a memory buffer that will eventually contain a value of interest. Many ULTs can wait on the eventual (a blocking call), until one ULT signals on that future.

Function Documentation

int ABT_eventual_create ( int  nbytes,
ABT_eventual neweventual 
)

Create an eventual.

ABT_eventual_create creates an eventual and returns a handle to the newly created eventual into neweventual. If nbytes is not zero, this routine allocates a memory buffer of nbytes size and creates a list of entries for all the ULTs that will be blocked waiting for the eventual to be ready. The list is initially empty. If nbytes is zero, the eventual is used without passing the data.

Parameters
[in]nbytessize in bytes of the memory buffer
[out]neweventualhandle to a new eventual
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 32 of file eventual.c.

int ABT_eventual_free ( ABT_eventual eventual)

Free the eventual object.

ABT_eventual_free releases memory associated with the eventual eventual. It also deallocates the memory buffer of the eventual. If it is successfully processed, eventual is set to ABT_EVENTUAL_NULL.

Parameters
[in,out]eventualhandle to the eventual
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 62 of file eventual.c.

int ABT_eventual_reset ( ABT_eventual  eventual)

Reset the readiness of the target eventual.

ABT_eventual_reset() resets the readiness of the target eventual eventual so that it can be reused. That is, it makes eventual unready irrespective of its readiness.

Parameters
[in]eventualhandle to the target eventual
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 306 of file eventual.c.

int ABT_eventual_set ( ABT_eventual  eventual,
void *  value,
int  nbytes 
)

Signal the eventual.

ABT_eventual_set sets a value in the eventual's buffer and releases all waiting ULTs. It copies nbytes bytes from the buffer pointed to by value into the internal buffer of eventual and awakes all ULTs waiting on the eventual. Therefore, all ULTs waiting on this eventual will be ready to be scheduled.

Parameters
[in]eventualhandle to the eventual
[in]valuepointer to the memory buffer containing the data that will be copied to the memory buffer of the eventual
[in]nbytesnumber of bytes to be copied
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 235 of file eventual.c.

int ABT_eventual_test ( ABT_eventual  eventual,
void **  value,
int *  is_ready 
)

Test the readiness of an eventual.

ABT_eventual_test does a nonblocking test on the eventual eventual if resolved. If the eventual is not ready, is_ready would equal FALSE. If the eventual is ready, the pointer pointed to by value will point to the memory buffer associated with the eventual.

Parameters
[in]eventualhandle to the eventual
[out]valuepointer to the memory buffer of the eventual
[out]is_readypointer to the a user flag
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 193 of file eventual.c.

int ABT_eventual_wait ( ABT_eventual  eventual,
void **  value 
)

Wait on the eventual.

ABT_eventual_wait blocks the caller ULT until the eventual eventual is resolved. If the eventual is not ready, the ULT calling this routine suspends and goes to the state BLOCKED. Internally, an entry is created per each blocked ULT to be awaken when the eventual is signaled. If the eventual is ready, the pointer pointed to by value will point to the memory buffer associated with the eventual. The system keeps a list of all the ULTs waiting on the eventual.

Parameters
[in]eventualhandle to the eventual
[out]valuepointer to the memory buffer of the eventual
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 104 of file eventual.c.