SimGrid
|
This section describes the functions that can be used by an agent for handling some task. More...
Functions | |
MSG_error_t | MSG_get_errno (void) |
Return the last value returned by a MSG function (except MSG_get_errno...). | |
MSG_error_t | MSG_task_execute (m_task_t task) |
Executes a task and waits for its termination. | |
MSG_error_t | MSG_process_sleep (double nb_sec) |
Sleep for the specified number of seconds. | |
MSG_error_t | MSG_task_get_from_host (m_task_t *task, m_channel_t channel, m_host_t host) |
Listen on channel and waits for receiving a task from host. | |
MSG_error_t | MSG_task_get (m_task_t *task, m_channel_t channel) |
Listen on a channel and wait for receiving a task. | |
MSG_error_t | MSG_task_get_with_timeout (m_task_t *task, m_channel_t channel, double max_duration) |
Listen on a channel and wait for receiving a task with a timeout. | |
msg_comm_t | MSG_task_isend (m_task_t task, const char *alias) |
Sends a task on a mailbox. | |
XBT_INLINE msg_comm_t | MSG_task_isend_with_matching (m_task_t task, const char *alias, int(*match_fun)(void *, void *), void *match_data) |
Sends a task on a mailbox, with support for matching requests. | |
void | MSG_task_dsend (m_task_t task, const char *alias, void_f_pvoid_t cleanup) |
Sends a task on a mailbox. | |
msg_comm_t | MSG_task_irecv (m_task_t *task, const char *name) |
Starts listening for receiving a task from an asynchronous communication. | |
int | MSG_comm_test (msg_comm_t comm) |
Checks whether a communication is done, and if yes, finalizes it. | |
int | MSG_comm_testany (xbt_dynar_t comms) |
This function checks if a communication is finished. | |
void | MSG_comm_destroy (msg_comm_t comm) |
Destroys a communication. | |
MSG_error_t | MSG_comm_wait (msg_comm_t comm, double timeout) |
Wait for the completion of a communication. | |
void | MSG_comm_waitall (msg_comm_t *comm, int nb_elem, double timeout) |
This function is called by a sender and permit to wait for each communication. | |
int | MSG_comm_waitany (xbt_dynar_t comms) |
This function waits for the first communication finished in a list. | |
MSG_error_t | MSG_comm_get_status (msg_comm_t comm) |
Returns the error (if any) that occured during a finished communication. | |
MSG_error_t | MSG_task_put (m_task_t task, m_host_t dest, m_channel_t channel) |
Put a task on a channel of an host and waits for the end of the transmission. | |
MSG_error_t | MSG_task_put_bounded (m_task_t task, m_host_t dest, m_channel_t channel, double maxrate) |
Does exactly the same as MSG_task_put but with a bounded transmition rate. | |
MSG_error_t | MSG_task_put_with_timeout (m_task_t task, m_host_t dest, m_channel_t channel, double timeout) |
int | MSG_task_Iprobe (m_channel_t channel) |
Test whether there is a pending communication on a channel. | |
int | MSG_task_probe_from_host (int channel, m_host_t host) |
Return the number of tasks waiting to be received on a channel and sent by host. | |
int | MSG_task_probe_from (m_channel_t channel) |
Test whether there is a pending communication on a channel, and who sent it. | |
int | MSG_host_is_avail (m_host_t h) |
Determine if a host is available. |
This section describes the functions that can be used by an agent for handling some task.
MSG_error_t MSG_task_execute | ( | m_task_t | task | ) |
Executes a task and waits for its termination.
This function is used for describing the behavior of an agent. It takes only one parameter.
task | a m_task_t to execute on the location on which the agent is running. |
MSG_error_t MSG_process_sleep | ( | double | nb_sec | ) |
Sleep for the specified number of seconds.
Makes the current process sleep until time seconds have elapsed.
nb_sec | a number of second |
MSG_error_t MSG_task_get_from_host | ( | m_task_t * | task, |
m_channel_t | channel, | ||
m_host_t | host | ||
) |
Listen on channel and waits for receiving a task from host.
It takes three parameters.
task | a memory location for storing a m_task_t. It will hold a task when this function will return. Thus task should not be equal to NULL and *task should be equal to NULL . If one of those two condition does not hold, there will be a warning message. |
channel | the channel on which the agent should be listening. This value has to be >=0 and < than the maximal number of channels fixed with MSG_set_channel_number(). |
host | the host that is to be watched. |
NULL
, #MSG_WARNING if *task is not equal to NULL
, and MSG_OK otherwise. MSG_error_t MSG_task_get | ( | m_task_t * | task, |
m_channel_t | channel | ||
) |
Listen on a channel and wait for receiving a task.
It takes two parameters.
task | a memory location for storing a m_task_t. It will hold a task when this function will return. Thus task should not be equal to NULL and *task should be equal to NULL . If one of those two condition does not hold, there will be a warning message. |
channel | the channel on which the agent should be listening. This value has to be >=0 and < than the maximal number of channels fixed with MSG_set_channel_number(). |
NULL
, #MSG_WARNING if *task is not equal to NULL
, and MSG_OK otherwise. MSG_error_t MSG_task_get_with_timeout | ( | m_task_t * | task, |
m_channel_t | channel, | ||
double | max_duration | ||
) |
Listen on a channel and wait for receiving a task with a timeout.
It takes three parameters.
task | a memory location for storing a m_task_t. It will hold a task when this function will return. Thus task should not be equal to NULL and *task should be equal to NULL . If one of those two condition does not hold, there will be a warning message. |
channel | the channel on which the agent should be listening. This value has to be >=0 and < than the maximal number of channels fixed with MSG_set_channel_number(). |
max_duration | the maximum time to wait for a task before giving up. In such a case, MSG_TRANSFER_FAILURE will be returned, task will not be modified and will still be equal to NULL when returning. |
NULL
, #MSG_WARNING if *task is not equal to NULL
, and MSG_OK otherwise. msg_comm_t MSG_task_isend | ( | m_task_t | task, |
const char * | alias | ||
) |
Sends a task on a mailbox.
This is a non blocking function: use MSG_comm_wait() or MSG_comm_test() to end the communication.
task | a m_task_t to send on another location. |
alias | name of the mailbox to sent the task to |
XBT_INLINE msg_comm_t MSG_task_isend_with_matching | ( | m_task_t | task, |
const char * | alias, | ||
int(*)(void *, void *) | match_fun, | ||
void * | match_data | ||
) |
Sends a task on a mailbox, with support for matching requests.
This is a non blocking function: use MSG_comm_wait() or MSG_comm_test() to end the communication.
task | a m_task_t to send on another location. |
alias | name of the mailbox to sent the task to |
match_fun | boolean function taking the #match_data provided by sender (here), and the one of the receiver (if any) and returning whether they match |
match_data | user provided data passed to match_fun |
void MSG_task_dsend | ( | m_task_t | task, |
const char * | alias, | ||
void_f_pvoid_t | cleanup | ||
) |
Sends a task on a mailbox.
This is a non blocking detached send function. Think of it as a best effort send. The communication object will be destroyed by the receiver (if any).
task | a m_task_t to send on another location. |
alias | name of the mailbox to sent the task to |
cleanup | a function to destroy the task if the communication fails (if NULL, MSG_task_destroy() will be used by default) |
msg_comm_t MSG_task_irecv | ( | m_task_t * | task, |
const char * | name | ||
) |
Starts listening for receiving a task from an asynchronous communication.
This is a non blocking function: use MSG_comm_wait() or MSG_comm_test() to end the communication.
task | a memory location for storing a m_task_t. |
name | of the mailbox to receive the task on |
int MSG_comm_test | ( | msg_comm_t | comm | ) |
Checks whether a communication is done, and if yes, finalizes it.
comm | the communication to test |
int MSG_comm_testany | ( | xbt_dynar_t | comms | ) |
This function checks if a communication is finished.
comms | a vector of communications |
void MSG_comm_destroy | ( | msg_comm_t | comm | ) |
Destroys a communication.
comm | the communication to destroy. |
MSG_error_t MSG_comm_wait | ( | msg_comm_t | comm, |
double | timeout | ||
) |
Wait for the completion of a communication.
It takes two parameters.
comm | the communication to wait. |
timeout | Wait until the communication terminates or the timeout occurs |
void MSG_comm_waitall | ( | msg_comm_t * | comm, |
int | nb_elem, | ||
double | timeout | ||
) |
This function is called by a sender and permit to wait for each communication.
comm | a vector of communication |
nb_elem | is the size of the comm vector |
timeout | for each call of MSG_comm_wait |
int MSG_comm_waitany | ( | xbt_dynar_t | comms | ) |
This function waits for the first communication finished in a list.
comms | a vector of communications |
MSG_error_t MSG_comm_get_status | ( | msg_comm_t | comm | ) |
Returns the error (if any) that occured during a finished communication.
comm | a finished communication |
MSG_error_t MSG_task_put | ( | m_task_t | task, |
m_host_t | dest, | ||
m_channel_t | channel | ||
) |
Put a task on a channel of an host and waits for the end of the transmission.
This function is used for describing the behavior of an agent. It takes three parameter.
task | a m_task_t to send on another location. This task will not be usable anymore when the function will return. There is no automatic task duplication and you have to save your parameters before calling this function. Tasks are unique and once it has been sent to another location, you should not access it anymore. You do not need to call MSG_task_destroy() but to avoid using, as an effect of inattention, this task anymore, you definitely should renitialize it with MSG_TASK_UNINITIALIZED. Note that this task can be transfered iff it has been correctly created with MSG_task_create(). |
dest | the destination of the message |
channel | the channel on which the agent should put this task. This value has to be >=0 and < than the maximal number of channels fixed with MSG_set_channel_number(). |
MSG_error_t MSG_task_put_bounded | ( | m_task_t | task, |
m_host_t | dest, | ||
m_channel_t | channel, | ||
double | maxrate | ||
) |
Does exactly the same as MSG_task_put but with a bounded transmition rate.
MSG_error_t MSG_task_put_with_timeout | ( | m_task_t | task, |
m_host_t | dest, | ||
m_channel_t | channel, | ||
double | timeout | ||
) |
\ host (with a timeout on the waiting of the destination host) and waits for the end of the transmission.
This function is used for describing the behavior of an agent. It takes four parameter.
task | a m_task_t to send on another location. This task will not be usable anymore when the function will return. There is no automatic task duplication and you have to save your parameters before calling this function. Tasks are unique and once it has been sent to another location, you should not access it anymore. You do not need to call MSG_task_destroy() but to avoid using, as an effect of inattention, this task anymore, you definitely should renitialize it with MSG_TASK_UNINITIALIZED. Note that this task can be transfered iff it has been correctly created with MSG_task_create(). |
dest | the destination of the message |
channel | the channel on which the agent should put this task. This value has to be >=0 and < than the maximal number of channels fixed with MSG_set_channel_number(). |
timeout | the maximum time to wait for a task before giving up. In such a case, MSG_TRANSFER_FAILURE will be returned, task will not be modified |
int MSG_task_Iprobe | ( | m_channel_t | channel | ) |
Test whether there is a pending communication on a channel.
It takes one parameter.
channel | the channel on which the agent should be listening. This value has to be >=0 and < than the maximal number of channels fixed with MSG_set_channel_number(). |
int MSG_task_probe_from_host | ( | int | channel, |
m_host_t | host | ||
) |
Return the number of tasks waiting to be received on a channel and sent by host.
It takes two parameters.
channel | the channel on which the agent should be listening. This value has to be >=0 and < than the maximal number of channels fixed with MSG_set_channel_number(). |
host | the host that is to be watched. |
int MSG_task_probe_from | ( | m_channel_t | channel | ) |
Test whether there is a pending communication on a channel, and who sent it.
It takes one parameter.
channel | the channel on which the agent should be listening. This value has to be >=0 and < than the maximal number of channels fixed with MSG_set_channel_number(). |
int MSG_host_is_avail | ( | m_host_t | h | ) |
Determine if a host is available.
h | host to test |
Back to the main Simgrid Documentation page |
The version of Simgrid documented here is v3.6.1. Documentation of other versions can be found in their respective archive files (directory doc/html). |
Generated for SimGridAPI by
![]() |