GNUnet 0.22.0
gnunet_scheduler_lib.h File Reference

API to schedule computations using continuation passing style. More...

Include dependency graph for gnunet_scheduler_lib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_SCHEDULER_FdInfo
 Information about an event relating to a file descriptor/socket. More...
 
struct  GNUNET_SCHEDULER_TaskContext
 Context information passed to each scheduler task. More...
 
struct  GNUNET_SCHEDULER_Driver
 API an external event loop has to implement for GNUNET_SCHEDULER_driver_init. More...
 

Typedefs

typedef void(* GNUNET_SCHEDULER_TaskCallback) (void *cls)
 Signature of the main function of a task. More...
 
typedef int(* GNUNET_SCHEDULER_select) (void *cls, struct GNUNET_NETWORK_FDSet *rfds, struct GNUNET_NETWORK_FDSet *wfds, struct GNUNET_NETWORK_FDSet *efds, struct GNUNET_TIME_Relative timeout)
 Signature of the select function used by the scheduler. More...
 

Enumerations

enum  GNUNET_SCHEDULER_Reason {
  GNUNET_SCHEDULER_REASON_NONE = 0 , GNUNET_SCHEDULER_REASON_STARTUP = 1 , GNUNET_SCHEDULER_REASON_SHUTDOWN = 2 , GNUNET_SCHEDULER_REASON_TIMEOUT = 4 ,
  GNUNET_SCHEDULER_REASON_READ_READY = 8 , GNUNET_SCHEDULER_REASON_WRITE_READY = 16 , GNUNET_SCHEDULER_REASON_PREREQ_DONE = 32
}
 Reasons why the schedule may have triggered the task now. More...
 
enum  GNUNET_SCHEDULER_EventType {
  GNUNET_SCHEDULER_ET_NONE = 0 , GNUNET_SCHEDULER_ET_IN = 1 , GNUNET_SCHEDULER_ET_OUT = 2 , GNUNET_SCHEDULER_ET_HUP = 4 ,
  GNUNET_SCHEDULER_ET_ERR = 8 , GNUNET_SCHEDULER_ET_PRI = 16 , GNUNET_SCHEDULER_ET_NVAL = 32
}
 Possible events on FDs, used as a bitmask. More...
 

Functions

void GNUNET_SCHEDULER_task_ready (struct GNUNET_SCHEDULER_Task *task, struct GNUNET_SCHEDULER_FdInfo *fdi)
 Function used by event-loop implementations to signal the scheduler that a particular task is ready due to an event specified in the et field of fdi. More...
 
int GNUNET_SCHEDULER_do_work (struct GNUNET_SCHEDULER_Handle *sh)
 Function called by external event loop implementations to tell the scheduler to run some of the tasks that are ready. More...
 
struct GNUNET_SCHEDULER_HandleGNUNET_SCHEDULER_driver_init (const struct GNUNET_SCHEDULER_Driver *driver)
 Function called by external event loop implementations to initialize the scheduler. More...
 
void GNUNET_SCHEDULER_driver_done (struct GNUNET_SCHEDULER_Handle *sh)
 Counter-part of GNUNET_SCHEDULER_driver_init. More...
 
struct GNUNET_SCHEDULER_DriverGNUNET_SCHEDULER_driver_select (void)
 Obtain the driver for using select() as the event loop. More...
 
void GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Initialize and run scheduler. More...
 
void GNUNET_SCHEDULER_run_with_optional_signals (int install_signals, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Initialize and run scheduler. More...
 
void GNUNET_SCHEDULER_shutdown (void)
 Request the shutdown of a scheduler. More...
 
unsigned int GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p)
 Get information about the current load of this scheduler. More...
 
const struct GNUNET_SCHEDULER_TaskContextGNUNET_SCHEDULER_get_task_context (void)
 Obtain the reasoning why the current task was started. More...
 
void * GNUNET_SCHEDULER_cancel (struct GNUNET_SCHEDULER_Task *task)
 Cancel the task with the specified identifier. More...
 
void GNUNET_SCHEDULER_add_with_reason_and_priority (GNUNET_SCHEDULER_TaskCallback task, void *task_cls, enum GNUNET_SCHEDULER_Reason reason, enum GNUNET_SCHEDULER_Priority priority)
 Continue the current execution with the given function. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run with a specified priority. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run as soon as possible. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_shutdown (GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run as soon as possible with the (transitive) ignore-shutdown flag either explicitly set or explicitly enabled. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run with a specified delay. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_at (struct GNUNET_TIME_Absolute at, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run at the specified time. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run with a specified delay. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_at_with_priority (struct GNUNET_TIME_Absolute at, enum GNUNET_SCHEDULER_Priority priority, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run at the specified time. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, struct GNUNET_NETWORK_Handle *rfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run with a specified delay or when the specified file descriptor is ready for reading. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, struct GNUNET_NETWORK_Handle *rfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run with a specified priority and to be run after the specified delay or when the specified file descriptor is ready for reading. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, struct GNUNET_NETWORK_Handle *wfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run with a specified delay or when the specified file descriptor is ready for writing. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_net_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, struct GNUNET_NETWORK_Handle *fd, int on_read, int on_write, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run with a specified delay or when the specified file descriptor is ready. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, const struct GNUNET_DISK_FileHandle *rfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run with a specified delay or when the specified file descriptor is ready for reading. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, const struct GNUNET_DISK_FileHandle *wfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run with a specified delay or when the specified file descriptor is ready for writing. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_file_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, const struct GNUNET_DISK_FileHandle *fd, int on_read, int on_write, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run with a specified delay or when the specified file descriptor is ready. More...
 
struct GNUNET_SCHEDULER_TaskGNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, struct GNUNET_TIME_Relative delay, const struct GNUNET_NETWORK_FDSet *rs, const struct GNUNET_NETWORK_FDSet *ws, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Schedule a new task to be run with a specified delay or when any of the specified file descriptor sets is ready. More...
 
void GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select, void *new_select_cls)
 Sets the select function to use in the scheduler (scheduler_select). More...
 
void GNUNET_SCHEDULER_begin_async_scope (struct GNUNET_AsyncScopeId *aid)
 Change the async scope for the currently executing task and (transitively) for all tasks scheduled by the current task after calling this function. More...
 

Detailed Description

API to schedule computations using continuation passing style.

Definition in file gnunet_scheduler_lib.h.