functions to manage operation queues More...
Go to the source code of this file.
Data Structures | |
struct | QueueEntry |
An entry in the operation queue. More... | |
struct | TimeSlot |
A slot to record time taken by an operation. More... | |
struct | FeedbackCtx |
Context for operation queues of type OPERATION_QUEUE_TYPE_ADAPTIVE. More... | |
struct | OperationQueue |
Queue of operations where we can only support a certain number of concurrent operations of a particular type. More... | |
struct | ReadyQueueEntry |
An entry in the ready queue (implemented as DLL) More... | |
struct | GNUNET_TESTBED_Operation |
Opaque handle to an abstract operation to be executed by the testing framework. More... | |
Macros | |
#define | ADAPTIVE_QUEUE_DEFAULT_HISTORY 40 |
The number of readings containing past operation's timing information that we keep track of for adaptive queues. More... | |
#define | ADAPTIVE_QUEUE_DEFAULT_MAX_ACTIVE 4 |
The number of parallel operations we start with by default for adaptive queues. More... | |
Enumerations | |
enum | OperationState { OP_STATE_INIT , OP_STATE_WAITING , OP_STATE_READY , OP_STATE_ACTIVE , OP_STATE_INACTIVE } |
Operation state. More... | |
Functions | |
static void | assign_timeslot (struct GNUNET_TESTBED_Operation *op, struct OperationQueue *queue) |
Assigns the given operation a time slot from the given operation queue. More... | |
static void | remove_queue_entry (struct GNUNET_TESTBED_Operation *op, unsigned int index) |
Removes a queue entry of an operation from one of the operation queues' lists depending on the state of the operation. More... | |
static void | change_state (struct GNUNET_TESTBED_Operation *op, enum OperationState state) |
Changes the state of the operation while moving its associated queue entries in the operation's operation queues. More... | |
static void | rq_remove (struct GNUNET_TESTBED_Operation *op) |
Removes an operation from the ready queue. More... | |
static void | process_rq_task (void *cls) |
Processes the ready queue by calling the operation start callback of the operation at the head. More... | |
static void | rq_add (struct GNUNET_TESTBED_Operation *op) |
Adds the operation to the ready queue and starts the 'process_rq_task'. More... | |
static int | is_queue_empty (struct OperationQueue *opq) |
Checks if the given operation queue is empty or not. More... | |
static int | decide_capacity (struct OperationQueue *opq, struct QueueEntry *entry, struct GNUNET_TESTBED_Operation ***ops_, unsigned int *n_ops_) |
Checks if the given operation queue has enough resources to provide for the operation of the given queue entry. More... | |
static void | merge_ops (struct GNUNET_TESTBED_Operation ***old, unsigned int *n_old, struct GNUNET_TESTBED_Operation **new, unsigned int n_new) |
Merges an array of operations into another, eliminating duplicates. More... | |
static int | check_readiness (struct GNUNET_TESTBED_Operation *op) |
Checks for the readiness of an operation and schedules a operation start task. More... | |
static void | defer (struct GNUNET_TESTBED_Operation *op) |
Defers a ready to be executed operation back to waiting. More... | |
static void | cleanup_tslots (struct OperationQueue *queue) |
Cleanups the array of timeslots of an operation queue. More... | |
static void | adaptive_queue_set_max_active (struct OperationQueue *queue, unsigned int n) |
Cleansup the existing timing slots and sets new timing slots in the given queue to accommodate given number of max active operations. More... | |
static void | adapt_parallelism (struct OperationQueue *queue) |
Adapts parallelism in an adaptive queue by using the statistical data from the feedback context. More... | |
static void | update_tslots (struct GNUNET_TESTBED_Operation *op) |
update tslots with the operation's completion time. More... | |
struct GNUNET_TESTBED_Operation * | GNUNET_TESTBED_operation_create_ (void *cls, OperationStart start, OperationRelease release) |
Create an 'operation' to be performed. More... | |
struct OperationQueue * | GNUNET_TESTBED_operation_queue_create_ (enum OperationQueueType type, unsigned int max_active) |
Create an operation queue. More... | |
static void | queue_destroy (struct OperationQueue *queue) |
Cleanup the given operation queue. More... | |
void | GNUNET_TESTBED_operation_queue_destroy_ (struct OperationQueue *queue) |
Destroys an operation queue. More... | |
int | GNUNET_TESTBED_operation_queue_destroy_empty_ (struct OperationQueue *queue) |
Destroys the operation queue if it is empty. More... | |
static void | recheck_waiting (struct OperationQueue *opq) |
Rechecks if any of the operations in the given operation queue's waiting list can be made active. More... | |
void | GNUNET_TESTBED_operation_queue_reset_max_active_ (struct OperationQueue *queue, unsigned int max_active) |
Function to reset the maximum number of operations in the given queue. More... | |
void | GNUNET_TESTBED_operation_queue_insert2_ (struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op, unsigned int nres) |
Add an operation to a queue. More... | |
void | GNUNET_TESTBED_operation_queue_insert_ (struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op) |
Add an operation to a queue. More... | |
void | GNUNET_TESTBED_operation_begin_wait_ (struct GNUNET_TESTBED_Operation *op) |
Marks the given operation as waiting on the queues. More... | |
void | GNUNET_TESTBED_operation_inactivate_ (struct GNUNET_TESTBED_Operation *op) |
Marks an active operation as inactive - the operation will be kept in a ready-to-be-released state and continues to hold resources until another operation contents for them. More... | |
void | GNUNET_TESTBED_operation_activate_ (struct GNUNET_TESTBED_Operation *op) |
Marks and inactive operation as active. More... | |
void | GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op) |
An operation is 'done' (was cancelled or finished); remove it from the queues and release associated resources. More... | |
void | GNUNET_TESTBED_operation_mark_failed (struct GNUNET_TESTBED_Operation *op) |
Marks an operation as failed. More... | |
void | __attribute__ ((destructor)) |
Cleanup expired operation queues. More... | |
Variables | |
static struct ReadyQueueEntry * | rq_head |
DLL head for the ready queue. More... | |
static struct ReadyQueueEntry * | rq_tail |
DLL tail for the ready queue. More... | |
static struct OperationQueue ** | expired_opqs |
Array of operation queues which are to be destroyed. More... | |
static unsigned int | n_expired_opqs |
Number of expired operation queues in the above array. More... | |
struct GNUNET_SCHEDULER_Task * | process_rq_task_id |
The id of the task to process the ready queue. More... | |
functions to manage operation queues
Definition in file testbed_api_operations.c.
#define ADAPTIVE_QUEUE_DEFAULT_HISTORY 40 |
The number of readings containing past operation's timing information that we keep track of for adaptive queues.
Definition at line 36 of file testbed_api_operations.c.
#define ADAPTIVE_QUEUE_DEFAULT_MAX_ACTIVE 4 |
The number of parallel operations we start with by default for adaptive queues.
Definition at line 42 of file testbed_api_operations.c.
enum OperationState |
Operation state.
Definition at line 250 of file testbed_api_operations.c.
|
static |
Assigns the given operation a time slot from the given operation queue.
op | the operation |
queue | the operation queue |
Definition at line 413 of file testbed_api_operations.c.
References FeedbackCtx::alloc_head, FeedbackCtx::alloc_tail, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CONTAINER_DLL_remove, op, TimeSlot::op, OPERATION_QUEUE_TYPE_ADAPTIVE, and queue().
Referenced by process_rq_task().
|
static |
Removes a queue entry of an operation from one of the operation queues' lists depending on the state of the operation.
op | the operation whose entry has to be removed |
index | the index of the entry in the operation's array of queue entries |
Definition at line 436 of file testbed_api_operations.c.
References OperationQueue::aq_head, OperationQueue::aq_tail, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, OperationQueue::nq_head, OperationQueue::nq_tail, op, OP_STATE_ACTIVE, OP_STATE_INACTIVE, OP_STATE_INIT, OP_STATE_READY, OP_STATE_WAITING, OperationQueue::rq_head, OperationQueue::rq_tail, OperationQueue::wq_head, and OperationQueue::wq_tail.
Referenced by change_state(), and GNUNET_TESTBED_operation_release_().
|
static |
Changes the state of the operation while moving its associated queue entries in the operation's operation queues.
op | the operation whose state has to be changed |
state | the state the operation should have. It cannot be OP_STATE_INIT |
Definition at line 476 of file testbed_api_operations.c.
References OperationQueue::aq_head, OperationQueue::aq_tail, GNUNET_array_append, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_new, OperationQueue::nq_head, OperationQueue::nq_tail, QueueEntry::nres, op, QueueEntry::op, OP_STATE_ACTIVE, OP_STATE_INACTIVE, OP_STATE_INIT, OP_STATE_READY, OP_STATE_WAITING, remove_queue_entry(), OperationQueue::rq_head, OperationQueue::rq_tail, state, OperationQueue::wq_head, and OperationQueue::wq_tail.
Referenced by check_readiness(), defer(), GNUNET_TESTBED_operation_activate_(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_inactivate_(), and process_rq_task().
|
static |
Removes an operation from the ready queue.
Also stops the 'process_rq_task' if the given operation is the last one in the queue.
op | the operation to be removed |
Definition at line 538 of file testbed_api_operations.c.
References GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_SCHEDULER_cancel(), op, process_rq_task_id, rq_head, and rq_tail.
Referenced by defer(), GNUNET_TESTBED_operation_release_(), and process_rq_task().
|
static |
Processes the ready queue by calling the operation start callback of the operation at the head.
The operation is then removed from the queue. The task is scheduled to run again immediately until no more operations are in the ready queue.
cls | NULL |
Definition at line 561 of file testbed_api_operations.c.
References assign_timeslot(), change_state(), GNUNET_assert, GNUNET_SCHEDULER_add_now(), GNUNET_TIME_absolute_get(), op, ReadyQueueEntry::op, OP_STATE_ACTIVE, OPERATION_QUEUE_TYPE_ADAPTIVE, process_rq_task_id, queue(), rq_head, and rq_remove().
Referenced by rq_add().
|
static |
Adds the operation to the ready queue and starts the 'process_rq_task'.
op | the operation to be queued |
Definition at line 592 of file testbed_api_operations.c.
References GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_new, GNUNET_SCHEDULER_add_now(), op, ReadyQueueEntry::op, process_rq_task(), process_rq_task_id, rq_head, and rq_tail.
Referenced by check_readiness().
|
static |
Checks if the given operation queue is empty or not.
opq | the operation queue |
Definition at line 614 of file testbed_api_operations.c.
References OperationQueue::aq_head, GNUNET_NO, GNUNET_YES, OperationQueue::nq_head, OperationQueue::rq_head, and OperationQueue::wq_head.
Referenced by __attribute__(), GNUNET_TESTBED_operation_queue_destroy_(), and GNUNET_TESTBED_operation_queue_destroy_empty_().
|
static |
Checks if the given operation queue has enough resources to provide for the operation of the given queue entry.
It also checks if any inactive operations are to be released in order to accommodate the needed resources and returns them as an array.
opq | the operation queue to check for resource accommodation |
entry | the operation queue entry whose operation's resources are to be accommodated |
ops_ | pointer to return the array of operations which are to be released in order to accommodate the new operation. Can be NULL |
n_ops_ | the number of operations in ops_ |
Definition at line 642 of file testbed_api_operations.c.
References OperationQueue::active, OperationQueue::fctx, GNUNET_array_append, GNUNET_assert, GNUNET_free, GNUNET_NO, GNUNET_YES, max, OperationQueue::max_active, QueueEntry::next, OperationQueue::nq_head, QueueEntry::nres, op, QueueEntry::op, OPERATION_QUEUE_TYPE_ADAPTIVE, OperationQueue::overload, ret, and OperationQueue::type.
Referenced by check_readiness().
|
static |
Merges an array of operations into another, eliminating duplicates.
No ordering is guaranteed.
old | the array into which the merging is done. |
n_old | the number of operations in old array |
new | the array from which operations are to be merged |
n_new | the number of operations in new array |
Definition at line 720 of file testbed_api_operations.c.
References GNUNET_array_append, and GNUNET_assert.
Referenced by check_readiness().
|
static |
Checks for the readiness of an operation and schedules a operation start task.
op | the operation |
Definition at line 755 of file testbed_api_operations.c.
References change_state(), decide_capacity(), GNUNET_assert, GNUNET_free, GNUNET_NO, GNUNET_TESTBED_operation_release_(), GNUNET_YES, merge_ops(), op, OP_STATE_READY, OP_STATE_WAITING, and rq_add().
Referenced by GNUNET_TESTBED_operation_begin_wait_(), and recheck_waiting().
|
static |
Defers a ready to be executed operation back to waiting.
op | the operation to defer |
Definition at line 806 of file testbed_api_operations.c.
References change_state(), GNUNET_assert, op, OP_STATE_READY, OP_STATE_WAITING, and rq_remove().
Referenced by GNUNET_TESTBED_operation_queue_reset_max_active_().
|
static |
Cleanups the array of timeslots of an operation queue.
For each time slot in the array, if it is allocated to an operation, it will be deallocated from the operation
queue | the operation queue |
Definition at line 829 of file testbed_api_operations.c.
References FeedbackCtx::alloc_head, FeedbackCtx::alloc_tail, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, op, TimeSlot::op, queue(), FeedbackCtx::tslots_filled, and FeedbackCtx::tslots_freeptr.
Referenced by adaptive_queue_set_max_active(), and queue_destroy().
|
static |
Cleansup the existing timing slots and sets new timing slots in the given queue to accommodate given number of max active operations.
queue | the queue |
n | the number of maximum active operations. If n is greater than the maximum limit set while creating the queue, then the minimum of these two will be selected as n |
Definition at line 863 of file testbed_api_operations.c.
References FeedbackCtx::alloc_head, FeedbackCtx::alloc_tail, cleanup_tslots(), GNUNET_CONTAINER_DLL_insert_tail, GNUNET_malloc, GNUNET_MIN, GNUNET_TESTBED_operation_queue_reset_max_active_(), FeedbackCtx::max_active_bound, FeedbackCtx::nfailed, queue(), TimeSlot::queue, and FeedbackCtx::tslots_freeptr.
Referenced by adapt_parallelism(), and GNUNET_TESTBED_operation_queue_create_().
|
static |
Adapts parallelism in an adaptive queue by using the statistical data from the feedback context.
queue | the queue |
Definition at line 891 of file testbed_api_operations.c.
References ADAPTIVE_QUEUE_DEFAULT_MAX_ACTIVE, adaptive_queue_set_max_active(), GNUNET_assert, GNUNET_MAX, GNUNET_SYSERR, GNUNET_TESTBED_SD_add_data_(), GNUNET_TESTBED_SD_deviation_factor_(), GNUNET_TIME_relative_add(), GNUNET_TIME_relative_divide(), GNUNET_TIME_UNIT_ZERO, FeedbackCtx::nfailed, TimeSlot::nvals, parallelism, queue(), GNUNET_TIME_Relative::rel_value_us, FeedbackCtx::sd, FeedbackCtx::tslots_freeptr, and TimeSlot::tsum.
Referenced by update_tslots().
|
static |
update tslots with the operation's completion time.
Additionally, if updating a timeslot makes all timeslots filled in an adaptive operation queue, call adapt_parallelism() for that queue.
op | the operation |
Definition at line 983 of file testbed_api_operations.c.
References adapt_parallelism(), FeedbackCtx::alloc_head, FeedbackCtx::alloc_tail, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_relative_add(), FeedbackCtx::nfailed, TimeSlot::nvals, op, TimeSlot::op, queue(), TimeSlot::queue, t, FeedbackCtx::tslots_filled, and TimeSlot::tsum.
Referenced by GNUNET_TESTBED_operation_release_().
struct GNUNET_TESTBED_Operation* GNUNET_TESTBED_operation_create_ | ( | void * | cls, |
OperationStart | start, | ||
OperationRelease | release | ||
) |
Create an 'operation' to be performed.
cls | closure for the callbacks |
start | function to call to start the operation |
release | function to call to close down the operation |
Definition at line 1028 of file testbed_api_operations.c.
References GNUNET_new, op, OP_STATE_INIT, GNUNET_TESTBED_Operation::release, and start.
Referenced by GNUNET_TESTBED_controller_link(), GNUNET_TESTBED_get_slave_config_(), GNUNET_TESTBED_get_statistics(), GNUNET_TESTBED_overlay_configure_topology_va(), GNUNET_TESTBED_overlay_connect(), GNUNET_TESTBED_peer_create(), GNUNET_TESTBED_peer_destroy(), GNUNET_TESTBED_peer_get_information(), GNUNET_TESTBED_peer_manage_service(), GNUNET_TESTBED_peer_start(), GNUNET_TESTBED_peer_stop(), GNUNET_TESTBED_peer_update_configuration(), GNUNET_TESTBED_service_connect(), GNUNET_TESTBED_shutdown_peers(), GST_connection_pool_get_handle(), and GST_neighbour_get_connection().
struct OperationQueue* GNUNET_TESTBED_operation_queue_create_ | ( | enum OperationQueueType | type, |
unsigned int | max_active | ||
) |
Create an operation queue.
type | the type of operation queue |
max_active | maximum number of operations in this queue that can be active in parallel at the same time. |
Definition at line 1043 of file testbed_api_operations.c.
References ADAPTIVE_QUEUE_DEFAULT_HISTORY, ADAPTIVE_QUEUE_DEFAULT_MAX_ACTIVE, adaptive_queue_set_max_active(), GNUNET_new, GNUNET_TESTBED_SD_init_(), FeedbackCtx::max_active_bound, OPERATION_QUEUE_TYPE_FIXED, queue(), FeedbackCtx::sd, and type.
Referenced by GNUNET_TESTBED_controller_connect(), GNUNET_TESTBED_get_statistics(), GNUNET_TESTBED_host_create_with_id(), and testbed_run().
|
static |
Cleanup the given operation queue.
queue | the operation queue to destroy |
Definition at line 1073 of file testbed_api_operations.c.
References cleanup_tslots(), GNUNET_free, GNUNET_TESTBED_SD_destroy_(), OPERATION_QUEUE_TYPE_ADAPTIVE, queue(), and FeedbackCtx::sd.
Referenced by __attribute__(), and GNUNET_TESTBED_operation_queue_destroy_().
void GNUNET_TESTBED_operation_queue_destroy_ | ( | struct OperationQueue * | queue | ) |
Destroys an operation queue.
Destroy an operation queue.
If the queue is still in use by operations it is marked as expired and its resources are released in the destructor GNUNET_TESTBED_operations_fini().
queue | queue to destroy |
Definition at line 1096 of file testbed_api_operations.c.
References expired_opqs, GNUNET_array_append, GNUNET_assert, GNUNET_YES, is_queue_empty(), n_expired_opqs, queue(), and queue_destroy().
Referenced by GNUNET_TESTBED_controller_disconnect(), GNUNET_TESTBED_host_destroy(), GNUNET_TESTBED_operation_queue_destroy_empty_(), and shutdown_task().
int GNUNET_TESTBED_operation_queue_destroy_empty_ | ( | struct OperationQueue * | queue | ) |
Destroys the operation queue if it is empty.
If not empty return GNUNET_NO.
queue | the queue to destroy if empty |
Definition at line 1117 of file testbed_api_operations.c.
References GNUNET_NO, GNUNET_TESTBED_operation_queue_destroy_(), GNUNET_YES, is_queue_empty(), and queue().
Referenced by oprelease_get_stats().
|
static |
Rechecks if any of the operations in the given operation queue's waiting list can be made active.
opq | the operation queue |
Definition at line 1133 of file testbed_api_operations.c.
References check_readiness(), GNUNET_NO, QueueEntry::next, QueueEntry::op, and OperationQueue::wq_head.
Referenced by GNUNET_TESTBED_operation_inactivate_(), GNUNET_TESTBED_operation_queue_reset_max_active_(), and GNUNET_TESTBED_operation_release_().
void GNUNET_TESTBED_operation_queue_reset_max_active_ | ( | struct OperationQueue * | queue, |
unsigned int | max_active | ||
) |
Function to reset the maximum number of operations in the given queue.
If max_active is lesser than the number of currently active operations, the active operations are not stopped immediately.
queue | the operation queue which has to be modified |
max_active | the new maximum number of active operations |
Definition at line 1158 of file testbed_api_operations.c.
References defer(), QueueEntry::op, queue(), and recheck_waiting().
Referenced by adaptive_queue_set_max_active().
void GNUNET_TESTBED_operation_queue_insert2_ | ( | struct OperationQueue * | queue, |
struct GNUNET_TESTBED_Operation * | op, | ||
unsigned int | nres | ||
) |
Add an operation to a queue.
An operation can be in multiple queues at once. Once the operation is inserted into all the queues GNUNET_TESTBED_operation_begin_wait_() has to be called to actually start waiting for the operation to become active.
queue | queue to add the operation to |
op | operation to add to the queue |
nres | the number of units of the resources of queue needed by the operation. Should be greater than 0. |
Definition at line 1184 of file testbed_api_operations.c.
References GNUNET_array_append, GNUNET_assert, QueueEntry::nres, op, and queue().
Referenced by GNUNET_TESTBED_operation_queue_insert_().
void GNUNET_TESTBED_operation_queue_insert_ | ( | struct OperationQueue * | queue, |
struct GNUNET_TESTBED_Operation * | op | ||
) |
Add an operation to a queue.
An operation can be in multiple queues at once. Once the operation is inserted into all the queues GNUNET_TESTBED_operation_begin_wait_() has to be called to actually start waiting for the operation to become active. The operation is assumed to take 1 queue resource. Use GNUNET_TESTBED_operation_queue_insert2_() if it requires more than 1
queue | queue to add the operation to |
op | operation to add to the queue |
Definition at line 1210 of file testbed_api_operations.c.
References GNUNET_TESTBED_operation_queue_insert2_(), op, and queue().
Referenced by GNUNET_TESTBED_controller_link(), GNUNET_TESTBED_get_slave_config_(), GNUNET_TESTBED_get_statistics(), GNUNET_TESTBED_host_queue_oc_(), GNUNET_TESTBED_overlay_configure_topology_va(), GNUNET_TESTBED_peer_create(), GNUNET_TESTBED_peer_destroy(), GNUNET_TESTBED_peer_get_information(), GNUNET_TESTBED_peer_manage_service(), GNUNET_TESTBED_peer_start(), GNUNET_TESTBED_peer_stop(), GNUNET_TESTBED_peer_update_configuration(), GNUNET_TESTBED_service_connect(), GNUNET_TESTBED_shutdown_peers(), GST_connection_pool_get_handle(), and GST_neighbour_get_connection().
void GNUNET_TESTBED_operation_begin_wait_ | ( | struct GNUNET_TESTBED_Operation * | op | ) |
Marks the given operation as waiting on the queues.
Once all queues permit the operation to become active, the operation will be activated. The actual activation will occur in a separate task (thus allowing multiple queue insertions to be made without having the first one instantly trigger the operation if the first queue has sufficient resources).
op | the operation to marks as waiting |
Definition at line 1227 of file testbed_api_operations.c.
References change_state(), check_readiness(), GNUNET_assert, op, and OP_STATE_WAITING.
Referenced by GNUNET_TESTBED_controller_link(), GNUNET_TESTBED_get_slave_config_(), GNUNET_TESTBED_get_statistics(), GNUNET_TESTBED_overlay_configure_topology_va(), GNUNET_TESTBED_overlay_connect(), GNUNET_TESTBED_peer_create(), GNUNET_TESTBED_peer_destroy(), GNUNET_TESTBED_peer_get_information(), GNUNET_TESTBED_peer_manage_service(), GNUNET_TESTBED_peer_start(), GNUNET_TESTBED_peer_stop(), GNUNET_TESTBED_peer_update_configuration(), GNUNET_TESTBED_service_connect(), GNUNET_TESTBED_shutdown_peers(), GST_connection_pool_get_handle(), and GST_neighbour_get_connection().
void GNUNET_TESTBED_operation_inactivate_ | ( | struct GNUNET_TESTBED_Operation * | op | ) |
Marks an active operation as inactive - the operation will be kept in a ready-to-be-released state and continues to hold resources until another operation contents for them.
op | the operation to be marked as inactive. The operation start callback should have been called before for this operation to mark it as inactive. |
Definition at line 1245 of file testbed_api_operations.c.
References change_state(), GNUNET_assert, GNUNET_free, GNUNET_malloc, GNUNET_memcpy, op, OP_STATE_ACTIVE, OP_STATE_INACTIVE, and recheck_waiting().
Referenced by GST_neighbour_get_connection_cancel(), and GST_neighbour_release_connection().
void GNUNET_TESTBED_operation_activate_ | ( | struct GNUNET_TESTBED_Operation * | op | ) |
Marks and inactive operation as active.
This function should be called to ensure that the oprelease callback will not be called until it is either marked as inactive or released.
op | the operation to be marked as active |
Definition at line 1274 of file testbed_api_operations.c.
References change_state(), GNUNET_assert, op, OP_STATE_ACTIVE, and OP_STATE_INACTIVE.
Referenced by GNUNET_TESTBED_operation_release_(), and trigger_notifications().
void GNUNET_TESTBED_operation_release_ | ( | struct GNUNET_TESTBED_Operation * | op | ) |
An operation is 'done' (was cancelled or finished); remove it from the queues and release associated resources.
op | operation that finished |
Definition at line 1288 of file testbed_api_operations.c.
References OperationQueue::active, GNUNET_assert, GNUNET_free, GNUNET_TESTBED_operation_activate_(), QueueEntry::nres, op, OP_STATE_ACTIVE, OP_STATE_INACTIVE, OP_STATE_INIT, OP_STATE_READY, OP_STATE_WAITING, recheck_waiting(), remove_queue_entry(), rq_remove(), and update_tslots().
Referenced by check_readiness(), GNUNET_TESTBED_operation_done(), and GST_neighbour_list_clean().
void GNUNET_TESTBED_operation_mark_failed | ( | struct GNUNET_TESTBED_Operation * | op | ) |
Marks an operation as failed.
op | the operation to be marked as failed |
Definition at line 1347 of file testbed_api_operations.c.
References GNUNET_YES, and op.
Referenced by handle_op_fail_event().
void __attribute__ | ( | (destructor) | ) |
Cleanup expired operation queues.
While doing so, also check for any operations which are not completed and warn about them.
Definition at line 1357 of file testbed_api_operations.c.
References expired_opqs, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_NO, is_queue_empty(), n_expired_opqs, queue(), and queue_destroy().
|
static |
DLL head for the ready queue.
Definition at line 382 of file testbed_api_operations.c.
Referenced by process_rq_task(), rq_add(), and rq_remove().
|
static |
DLL tail for the ready queue.
Definition at line 387 of file testbed_api_operations.c.
Referenced by rq_add(), and rq_remove().
|
static |
Array of operation queues which are to be destroyed.
Definition at line 392 of file testbed_api_operations.c.
Referenced by __attribute__(), and GNUNET_TESTBED_operation_queue_destroy_().
|
static |
Number of expired operation queues in the above array.
Definition at line 397 of file testbed_api_operations.c.
Referenced by __attribute__(), and GNUNET_TESTBED_operation_queue_destroy_().
struct GNUNET_SCHEDULER_Task* process_rq_task_id |
The id of the task to process the ready queue.
Definition at line 402 of file testbed_api_operations.c.
Referenced by process_rq_task(), rq_add(), and rq_remove().