command to wait for completion of async command More...
Go to the source code of this file.
Data Structures | |
struct | FinishState |
Struct to use for command-specific context information closure of a command waiting for another command. More... | |
Functions | |
static void | done_finish (void *cls) |
Function called when the command we are waiting on is finished. More... | |
static void | timeout_finish (void *cls) |
Function triggered if the command we are waiting for did not complete on time. More... | |
static void | run_finish (void *cls, struct GNUNET_TESTING_Interpreter *is) |
Run method of the command created by the interpreter to wait for another command to finish. More... | |
static void | cleanup_finish (void *cls) |
Cleanup state of a finish command. More... | |
const struct GNUNET_TESTING_Command | GNUNET_TESTING_cmd_finish (const char *finish_label, const char *cmd_ref, struct GNUNET_TIME_Relative timeout) |
Create (synchronous) command that waits for another command to finish. More... | |
struct GNUNET_TESTING_Command | GNUNET_TESTING_cmd_make_unblocking (struct GNUNET_TESTING_Command cmd) |
Turn asynchronous command into non-blocking command by setting asynchronous_finish to true. More... | |
command to wait for completion of async command
Definition in file testing_api_cmd_finish.c.
|
static |
Function called when the command we are waiting on is finished.
Hence we are finished, too.
cls | a struct FinishState being notified |
Definition at line 83 of file testing_api_cmd_finish.c.
References FinishState::ac, FinishState::cls, FinishState::finish_task, GNUNET_SCHEDULER_cancel(), GNUNET_TESTING_async_finish(), FinishState::old_notify, and FinishState::old_notify_cls.
Referenced by run_finish().
|
static |
Function triggered if the command we are waiting for did not complete on time.
cls | our struct FinishState |
Definition at line 105 of file testing_api_cmd_finish.c.
References FinishState::ac, FinishState::async_label, FinishState::cls, FinishState::finish_task, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, and GNUNET_TESTING_async_fail().
Referenced by run_finish().
|
static |
Run method of the command created by the interpreter to wait for another command to finish.
Definition at line 123 of file testing_api_cmd_finish.c.
References GNUNET_TESTING_Command::ac, FinishState::ac, FinishState::async_label, GNUNET_TESTING_Command::asynchronous_finish, FinishState::cls, done_finish(), FinishState::finish_task, GNUNET_TESTING_AsyncContext::finished, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_SCHEDULER_add_delayed(), GNUNET_TESTING_async_finish(), GNUNET_TESTING_FAIL, GNUNET_TESTING_interpreter_lookup_command(), is, GNUNET_TESTING_AsyncContext::notify_finished, GNUNET_TESTING_AsyncContext::notify_finished_cls, FinishState::old_notify, FinishState::old_notify_cls, FinishState::timeout, and timeout_finish().
Referenced by GNUNET_TESTING_cmd_finish(), and GNUNET_TESTING_cmd_make_unblocking().
|
static |
Cleanup state of a finish command.
cls | a struct FinishState to clean up |
Definition at line 174 of file testing_api_cmd_finish.c.
References FinishState::cls, FinishState::finish_task, GNUNET_free, and GNUNET_SCHEDULER_cancel().
Referenced by GNUNET_TESTING_cmd_finish().
const struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_finish | ( | const char * | finish_label, |
const char * | cmd_ref, | ||
struct GNUNET_TIME_Relative | timeout | ||
) |
Create (synchronous) command that waits for another command to finish.
If cmd_ref did not finish after timeout, this command will fail the test case.
finish_label | label for this command |
cmd_ref | reference to a previous command which we should wait for (call finish() on) |
timeout | how long to wait at most for cmd_ref to finish |
Definition at line 188 of file testing_api_cmd_finish.c.
References FinishState::ac, FinishState::async_label, cleanup_finish(), GNUNET_new, GNUNET_TESTING_command_new_ac(), run_finish(), timeout, and FinishState::timeout.
Referenced by main().
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_make_unblocking | ( | struct GNUNET_TESTING_Command | cmd | ) |
Turn asynchronous command into non-blocking command by setting asynchronous_finish to true.
Modifies (and then returns) cmd simply setting the bit. By default, most commands are blocking, and by wrapping the command construction in this function a blocking command can be turned into an asynchronous command where the interpreter continues after initiating the asynchronous action. Does nothing if the command is fundamentally synchronous.
[in,out] | cmd | command to make non-blocking |
Definition at line 209 of file testing_api_cmd_finish.c.
References GNUNET_assert, and run_finish().
Referenced by main().