GNUnet  0.10.x
Data Structures | Macros | Functions | Variables
scheduler.c File Reference

schedule computations using continuation passing style More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "disk.h"
#include <inttypes.h>
Include dependency graph for scheduler.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_SCHEDULER_Handle
 Argument to be passed from the driver to GNUNET_SCHEDULER_do_work(). More...
 
struct  GNUNET_SCHEDULER_Task
 Entry in list of pending tasks. More...
 
struct  Scheduled
 A struct representing an event the select driver is waiting for. More...
 
struct  DriverContext
 Driver context used by GNUNET_SCHEDULER_run. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from(kind, "util-scheduler", __VA_ARGS__)
 
#define LOG_STRERROR(kind, syscall)   GNUNET_log_from_strerror(kind, "util-scheduler", syscall)
 
#define PROFILE_DELAYS   GNUNET_NO
 Should we figure out which tasks are delayed for a while before they are run? (Consider using in combination with EXECINFO). More...
 
#define DELAY_THRESHOLD   GNUNET_TIME_UNIT_SECONDS
 Task that were in the queue for longer than this are reported if PROFILE_DELAYS is active. More...
 

Functions

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...
 
static enum GNUNET_SCHEDULER_Priority check_priority (enum GNUNET_SCHEDULER_Priority p)
 Check that the given priority is legal (and return it). More...
 
struct GNUNET_TIME_Absolute get_timeout ()
 chooses the nearest timeout from all pending tasks, to be used to tell the driver the next wakeup time (using its set_wakeup callback) More...
 
static void queue_ready_task (struct GNUNET_SCHEDULER_Task *task)
 Put a task that is ready for execution into the ready queue. More...
 
void GNUNET_SCHEDULER_shutdown ()
 Request the shutdown of a scheduler. More...
 
static void dump_backtrace (struct GNUNET_SCHEDULER_Task *t)
 Output stack trace of task t. More...
 
static void destroy_task (struct GNUNET_SCHEDULER_Task *t)
 Destroy a task (release associated resources) More...
 
static void sighandler_pipe ()
 Signal handler called for SIGPIPE. More...
 
static void sighandler_shutdown ()
 Wait for a short time. More...
 
static void shutdown_if_no_lifeness ()
 
static int select_loop (struct GNUNET_SCHEDULER_Handle *sh, struct DriverContext *context)
 
void GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
 Initialize and run scheduler. More...
 
const struct GNUNET_SCHEDULER_TaskContextGNUNET_SCHEDULER_get_task_context ()
 Obtain the task context, giving the reason why the current task was started. More...
 
unsigned int GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p)
 Get information about the current load of this scheduler. More...
 
void init_fd_info (struct GNUNET_SCHEDULER_Task *t, const struct GNUNET_NETWORK_Handle *const *read_nh, unsigned int read_nh_len, const struct GNUNET_NETWORK_Handle *const *write_nh, unsigned int write_nh_len, const struct GNUNET_DISK_FileHandle *const *read_fh, unsigned int read_fh_len, const struct GNUNET_DISK_FileHandle *const *write_fh, unsigned int write_fh_len)
 
static void driver_add_multiple (struct GNUNET_SCHEDULER_Task *t)
 calls the given function func on each FdInfo related to t. More...
 
static void install_parent_control_handler (void *cls)
 
static void shutdown_pipe_cb (void *cls)
 
void * GNUNET_SCHEDULER_cancel (struct GNUNET_SCHEDULER_Task *task)
 Cancel the task with the specified identifier. More...
 
static void init_backtrace (struct GNUNET_SCHEDULER_Task *t)
 Initialize backtrace data for task t. 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_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_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_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_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 (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_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...
 
static struct GNUNET_SCHEDULER_Taskadd_without_sets (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, const struct GNUNET_NETWORK_Handle *read_nh, const struct GNUNET_NETWORK_Handle *write_nh, const struct GNUNET_DISK_FileHandle *read_fh, const struct GNUNET_DISK_FileHandle *write_fh, 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...
 
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...
 
void extract_handles (const struct GNUNET_NETWORK_FDSet *fdset, const struct GNUNET_NETWORK_Handle ***ntarget, unsigned int *extracted_nhandles, const struct GNUNET_DISK_FileHandle ***ftarget, unsigned int *extracted_fhandles)
 
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_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...
 
static int select_add (void *cls, struct GNUNET_SCHEDULER_Task *task, struct GNUNET_SCHEDULER_FdInfo *fdi)
 
static int select_del (void *cls, struct GNUNET_SCHEDULER_Task *task)
 
static void select_set_wakeup (void *cls, struct GNUNET_TIME_Absolute dt)
 
struct GNUNET_SCHEDULER_DriverGNUNET_SCHEDULER_driver_select ()
 Obtain the driver for using select() as the event loop. 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...
 

Variables

static const struct GNUNET_SCHEDULER_Driverscheduler_driver
 The driver used for the event loop. More...
 
static struct GNUNET_SCHEDULER_Taskpending_head
 Head of list of tasks waiting for an event. More...
 
static struct GNUNET_SCHEDULER_Taskpending_tail
 Tail of list of tasks waiting for an event. More...
 
static struct GNUNET_SCHEDULER_Taskshutdown_head
 Head of list of tasks waiting for shutdown. More...
 
static struct GNUNET_SCHEDULER_Taskshutdown_tail
 Tail of list of tasks waiting for shutdown. More...
 
static struct GNUNET_SCHEDULER_Taskpending_timeout_head
 List of tasks waiting ONLY for a timeout event. More...
 
static struct GNUNET_SCHEDULER_Taskpending_timeout_tail
 List of tasks waiting ONLY for a timeout event. More...
 
static struct GNUNET_SCHEDULER_Taskpending_timeout_last
 Last inserted task waiting ONLY for a timeout event. More...
 
static struct GNUNET_SCHEDULER_Taskactive_task
 ID of the task that is running right now. More...
 
static struct GNUNET_SCHEDULER_Taskready_head [GNUNET_SCHEDULER_PRIORITY_COUNT]
 Head of list of tasks ready to run right now, grouped by importance. More...
 
static struct GNUNET_SCHEDULER_Taskready_tail [GNUNET_SCHEDULER_PRIORITY_COUNT]
 Tail of list of tasks ready to run right now, grouped by importance. More...
 
static struct GNUNET_SCHEDULER_Taskinstall_parent_control_task
 Task for installing parent control handlers (it might happen that the scheduler is shutdown before this task is executed, so GNUNET_SCHEDULER_shutdown must cancel it in that case) More...
 
static struct GNUNET_SCHEDULER_Taskshutdown_pipe_task
 Task for reading from a pipe that signal handlers will use to initiate shutdown. More...
 
static unsigned int ready_count
 Number of tasks on the ready list. More...
 
static enum GNUNET_SCHEDULER_Priority current_priority
 Priority of the task running right now. More...
 
static enum GNUNET_SCHEDULER_Priority max_priority_added
 Priority of the highest task added in the current select iteration. More...
 
static int current_lifeness
 Value of the 'lifeness' flag for the current task. More...
 
static GNUNET_SCHEDULER_select scheduler_select
 Function to use as a select() in the scheduler. More...
 
static struct GNUNET_SCHEDULER_TaskContext tc
 Task context of the current task. More...
 
static void * scheduler_select_cls
 Closure for scheduler_select. More...
 
static struct GNUNET_DISK_PipeHandleshutdown_pipe_handle
 Pipe used to communicate shutdown via signal. More...
 
static pid_t my_pid
 Process ID of this process at the time we installed the various signal handlers. More...
 

Detailed Description

schedule computations using continuation passing style

Author
Christian Grothoff

Definition in file scheduler.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from(kind, "util-scheduler", __VA_ARGS__)

◆ LOG_STRERROR

#define LOG_STRERROR (   kind,
  syscall 
)    GNUNET_log_from_strerror(kind, "util-scheduler", syscall)

Definition at line 33 of file scheduler.c.

Referenced by select_loop().

◆ PROFILE_DELAYS

#define PROFILE_DELAYS   GNUNET_NO

Should we figure out which tasks are delayed for a while before they are run? (Consider using in combination with EXECINFO).

Definition at line 65 of file scheduler.c.

◆ DELAY_THRESHOLD

#define DELAY_THRESHOLD   GNUNET_TIME_UNIT_SECONDS

Task that were in the queue for longer than this are reported if PROFILE_DELAYS is active.

Definition at line 71 of file scheduler.c.

Referenced by GNUNET_SCHEDULER_do_work().

Function Documentation

◆ check_priority()

static enum GNUNET_SCHEDULER_Priority check_priority ( enum GNUNET_SCHEDULER_Priority  p)
static

Check that the given priority is legal (and return it).

Parameters
ppriority value to check
Returns
p on success, 0 on error

Definition at line 441 of file scheduler.c.

References GNUNET_assert, GNUNET_SCHEDULER_PRIORITY_COUNT, and p.

Referenced by add_without_sets(), GNUNET_SCHEDULER_add_at_with_priority(), GNUNET_SCHEDULER_add_select(), GNUNET_SCHEDULER_add_with_reason_and_priority(), GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_get_load(), and queue_ready_task().

442 {
443  if ((p >= 0) && (p < GNUNET_SCHEDULER_PRIORITY_COUNT))
444  return p;
445  GNUNET_assert(0);
446  return 0; /* make compiler happy */
447 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
Number of priorities (must be the last priority).
Here is the caller graph for this function:

◆ get_timeout()

struct GNUNET_TIME_Absolute get_timeout ( )

chooses the nearest timeout from all pending tasks, to be used to tell the driver the next wakeup time (using its set_wakeup callback)

Definition at line 456 of file scheduler.c.

References GNUNET_TIME_Absolute::abs_value_us, GNUNET_TIME_absolute_get(), GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_SCHEDULER_Task::next, pending_timeout_head, and timeout.

Referenced by GNUNET_SCHEDULER_do_work(), and GNUNET_SCHEDULER_driver_init().

457 {
458  struct GNUNET_SCHEDULER_Task *pos;
459  struct GNUNET_TIME_Absolute now;
461 
462  pos = pending_timeout_head;
463  now = GNUNET_TIME_absolute_get();
465  if (NULL != pos)
466  {
467  if (0 != pos->reason)
468  {
469  return now;
470  }
471  else
472  {
473  timeout = pos->timeout;
474  }
475  }
476  for (pos = pending_head; NULL != pos; pos = pos->next)
477  {
478  if (0 != pos->reason)
479  {
480  return now;
481  }
482  else if ((pos->timeout.abs_value_us != GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) &&
483  (timeout.abs_value_us > pos->timeout.abs_value_us))
484  {
485  timeout = pos->timeout;
486  }
487  }
488  return timeout;
489 }
static struct GNUNET_SCHEDULER_Task * pending_head
Head of list of tasks waiting for an event.
Definition: scheduler.c:310
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition: gnunet-arm.c:114
static struct GNUNET_SCHEDULER_Task * pending_timeout_head
List of tasks waiting ONLY for a timeout event.
Definition: scheduler.c:334
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
struct GNUNET_SCHEDULER_Task * next
This is a linked list.
Definition: scheduler.c:135
Entry in list of pending tasks.
Definition: scheduler.c:131
Time for absolute times used by GNUnet, in microseconds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ queue_ready_task()

static void queue_ready_task ( struct GNUNET_SCHEDULER_Task task)
static

Put a task that is ready for execution into the ready queue.

Parameters
tasktask ready for execution

Definition at line 498 of file scheduler.c.

References check_priority(), GNUNET_CONTAINER_DLL_insert, GNUNET_YES, GNUNET_SCHEDULER_Task::in_ready_list, p, GNUNET_SCHEDULER_Task::priority, and ready_count.

Referenced by GNUNET_SCHEDULER_add_with_reason_and_priority(), GNUNET_SCHEDULER_do_work(), GNUNET_SCHEDULER_shutdown(), and GNUNET_SCHEDULER_task_ready().

499 {
501 
503  ready_tail[p],
504  task);
505  task->in_ready_list = GNUNET_YES;
506  ready_count++;
507 }
static unsigned int ready_count
Number of tasks on the ready list.
Definition: scheduler.c:382
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
GNUNET_SCHEDULER_Priority
Valid task priorities.
static struct GNUNET_SCHEDULER_Task * ready_tail[GNUNET_SCHEDULER_PRIORITY_COUNT]
Tail of list of tasks ready to run right now, grouped by importance.
Definition: scheduler.c:364
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
static struct GNUNET_SCHEDULER_Task * ready_head[GNUNET_SCHEDULER_PRIORITY_COUNT]
Head of list of tasks ready to run right now, grouped by importance.
Definition: scheduler.c:359
static enum GNUNET_SCHEDULER_Priority check_priority(enum GNUNET_SCHEDULER_Priority p)
Check that the given priority is legal (and return it).
Definition: scheduler.c:441
#define GNUNET_YES
Definition: gnunet_common.h:77
enum GNUNET_SCHEDULER_Priority priority
Task priority.
Definition: scheduler.c:199
int in_ready_list
Is this task in the ready list?
Definition: scheduler.c:225
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_backtrace()

static void dump_backtrace ( struct GNUNET_SCHEDULER_Task t)
static

Output stack trace of task t.

Parameters
ttask to dump stack trace of

Definition at line 550 of file scheduler.c.

References GNUNET_ERROR_TYPE_WARNING, and LOG.

Referenced by GNUNET_SCHEDULER_do_work(), init_backtrace(), and select_loop().

551 {
552 #if EXECINFO
553  for (unsigned int i = 0; i < t->num_backtrace_strings; i++)
555  "Task %p trace %u: %s\n",
556  t,
557  i,
558  t->backtrace_strings[i]);
559 #else
560  (void)t;
561 #endif
562 }
#define LOG(kind,...)
Definition: scheduler.c:31
Here is the caller graph for this function:

◆ destroy_task()

static void destroy_task ( struct GNUNET_SCHEDULER_Task t)
static

Destroy a task (release associated resources)

Parameters
ttask to destroy

Definition at line 571 of file scheduler.c.

References GNUNET_NETWORK_Handle::fd, GNUNET_SCHEDULER_FdInfo::fd, GNUNET_SCHEDULER_Task::fds, GNUNET_SCHEDULER_Task::fds_len, fh, GNUNET_SCHEDULER_FdInfo::fh, GNUNET_array_grow, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_NETWORK_socket_free_memory_only_(), GNUNET_YES, LOG, and GNUNET_SCHEDULER_Task::own_handles.

Referenced by GNUNET_SCHEDULER_cancel(), and GNUNET_SCHEDULER_do_work().

572 {
573  unsigned int i;
574 
576  "destroying task %p\n",
577  t);
578 
579  if (GNUNET_YES == t->own_handles)
580  {
581  for (i = 0; i != t->fds_len; ++i)
582  {
583  const struct GNUNET_NETWORK_Handle *fd = t->fds[i].fd;
584  const struct GNUNET_DISK_FileHandle *fh = t->fds[i].fh;
585  if (fd)
586  {
588  }
589  if (fh)
590  {
591  // FIXME: on WIN32 this is not enough! A function
592  // GNUNET_DISK_file_free_memory_only would be nice
593  GNUNET_free((void *)fh);
594  }
595  }
596  }
597  if (t->fds_len > 1)
598  {
599  GNUNET_array_grow(t->fds, t->fds_len, 0);
600  }
601 #if EXECINFO
602  GNUNET_free(t->backtrace_strings);
603 #endif
604  GNUNET_free(t);
605 }
void GNUNET_NETWORK_socket_free_memory_only_(struct GNUNET_NETWORK_Handle *desc)
Only free memory of a socket, keep the file descriptor untouched.
Definition: network.c:610
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
const struct GNUNET_DISK_FileHandle * fh
GNUnet file handle the event is about, matches sock, NULL if this is about a network socket or if no ...
const struct GNUNET_NETWORK_Handle * fd
GNUnet network socket the event is about, matches sock, NULL if this is about a file handle or if no ...
static int fh
Handle to the unique file.
struct GNUNET_SCHEDULER_FdInfo * fds
Information about which FDs are ready for this task (and why).
Definition: scheduler.c:155
#define LOG(kind,...)
Definition: scheduler.c:31
unsigned int fds_len
Size of the fds array.
Definition: scheduler.c:167
int own_handles
Do we own the network and file handles referenced by the FdInfo structs in the fds array...
Definition: scheduler.c:174
handle to a socket
Definition: network.c:46
#define GNUNET_YES
Definition: gnunet_common.h:77
Handle used to access files (and pipes).
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sighandler_pipe()

static void sighandler_pipe ( )
static

Signal handler called for SIGPIPE.

Definition at line 623 of file scheduler.c.

Referenced by GNUNET_SCHEDULER_driver_init().

624 {
625  return;
626 }
Here is the caller graph for this function:

◆ sighandler_shutdown()

static void sighandler_shutdown ( )
static

Wait for a short time.

Sleeps for ms ms (as that should be long enough for virtually all modern systems to context switch and allow another process to do some 'real' work).

Parameters
mshow many ms to wait Signal handler called for signals that should cause us to shutdown.

Definition at line 651 of file scheduler.c.

References GNUNET_DISK_file_write(), GNUNET_DISK_PIPE_END_WRITE, GNUNET_DISK_pipe_handle(), and my_pid.

Referenced by GNUNET_SCHEDULER_driver_init().

652 {
653  static char c;
654  int old_errno = errno; /* backup errno */
655 
656  if (getpid() != my_pid)
657  _exit(1); /* we have fork'ed since the signal handler was created,
658  * ignore the signal, see https://gnunet.org/vfork discussion */
661  &c, sizeof(c));
662  errno = old_errno;
663 }
static pid_t my_pid
Process ID of this process at the time we installed the various signal handlers.
Definition: scheduler.c:617
static struct GNUNET_DISK_PipeHandle * shutdown_pipe_handle
Pipe used to communicate shutdown via signal.
Definition: scheduler.c:611
const struct GNUNET_DISK_FileHandle * GNUNET_DISK_pipe_handle(const struct GNUNET_DISK_PipeHandle *p, enum GNUNET_DISK_PipeEnd n)
Get the handle to a particular pipe end.
Definition: disk.c:1744
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:817
The writing-end of a pipe.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown_if_no_lifeness()

static void shutdown_if_no_lifeness ( )
static

Definition at line 667 of file scheduler.c.

References context, GNUNET_SCHEDULER_shutdown(), GNUNET_YES, GNUNET_SCHEDULER_Task::lifeness, GNUNET_SCHEDULER_Task::next, ready_count, select_loop(), sh, and t.

Referenced by GNUNET_SCHEDULER_do_work().

668 {
669  struct GNUNET_SCHEDULER_Task *t;
670 
671  if (ready_count > 0)
672  return;
673  for (t = pending_head; NULL != t; t = t->next)
674  if (GNUNET_YES == t->lifeness)
675  return;
676  for (t = shutdown_head; NULL != t; t = t->next)
677  if (GNUNET_YES == t->lifeness)
678  return;
679  for (t = pending_timeout_head; NULL != t; t = t->next)
680  if (GNUNET_YES == t->lifeness)
681  return;
682  /* No lifeness! */
684 }
static unsigned int ready_count
Number of tasks on the ready list.
Definition: scheduler.c:382
static struct GNUNET_SCHEDULER_Task * pending_head
Head of list of tasks waiting for an event.
Definition: scheduler.c:310
static struct GNUNET_SCHEDULER_Task * t
Main task.
void GNUNET_SCHEDULER_shutdown()
Request the shutdown of a scheduler.
Definition: scheduler.c:517
static struct GNUNET_SCHEDULER_Task * pending_timeout_head
List of tasks waiting ONLY for a timeout event.
Definition: scheduler.c:334
struct GNUNET_SCHEDULER_Task * next
This is a linked list.
Definition: scheduler.c:135
Entry in list of pending tasks.
Definition: scheduler.c:131
#define GNUNET_YES
Definition: gnunet_common.h:77
static struct GNUNET_SCHEDULER_Task * shutdown_head
Head of list of tasks waiting for shutdown.
Definition: scheduler.c:320
int lifeness
Should the existence of this task in the queue be counted as reason to not shutdown the scheduler...
Definition: scheduler.c:215
Here is the call graph for this function:
Here is the caller graph for this function:

◆ select_loop()

static int select_loop ( struct GNUNET_SCHEDULER_Handle sh,
struct DriverContext context 
)
static

Definition at line 2254 of file scheduler.c.

References GNUNET_TIME_Absolute::abs_value_us, dump_backtrace(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_NETWORK_fdset_create(), GNUNET_NETWORK_fdset_destroy(), GNUNET_NETWORK_fdset_set_native(), GNUNET_NETWORK_fdset_test_native(), GNUNET_NETWORK_fdset_zero(), GNUNET_NETWORK_socket_select(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_do_work(), GNUNET_SCHEDULER_ET_IN, GNUNET_SCHEDULER_ET_OUT, GNUNET_SCHEDULER_task_ready(), GNUNET_STRINGS_absolute_time_to_string(), GNUNET_SYSERR, GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_YES, LOG, LOG_STRERROR, Scheduled::next, GNUNET_SCHEDULER_Handle::rs, DriverContext::scheduled_head, scheduler_select, scheduler_select_cls, DriverContext::timeout, and GNUNET_SCHEDULER_Handle::ws.

Referenced by GNUNET_SCHEDULER_run(), and shutdown_if_no_lifeness().

2256 {
2257  struct GNUNET_NETWORK_FDSet *rs;
2258  struct GNUNET_NETWORK_FDSet *ws;
2259  int select_result;
2260 
2261  GNUNET_assert(NULL != context);
2264  while ((NULL != context->scheduled_head) ||
2265  (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != context->timeout.abs_value_us))
2266  {
2268  "select timeout = %s\n",
2270 
2273 
2274  for (struct Scheduled *pos = context->scheduled_head;
2275  NULL != pos;
2276  pos = pos->next)
2277  {
2278  if (0 != (GNUNET_SCHEDULER_ET_IN & pos->et))
2279  {
2280  GNUNET_NETWORK_fdset_set_native(rs, pos->fdi->sock);
2281  }
2282  if (0 != (GNUNET_SCHEDULER_ET_OUT & pos->et))
2283  {
2284  GNUNET_NETWORK_fdset_set_native(ws, pos->fdi->sock);
2285  }
2286  }
2287  struct GNUNET_TIME_Relative time_remaining =
2289  if (NULL == scheduler_select)
2290  {
2291  select_result = GNUNET_NETWORK_socket_select(rs,
2292  ws,
2293  NULL,
2294  time_remaining);
2295  }
2296  else
2297  {
2298  select_result = scheduler_select(scheduler_select_cls,
2299  rs,
2300  ws,
2301  NULL,
2302  time_remaining);
2303  }
2304  if (select_result == GNUNET_SYSERR)
2305  {
2306  if (errno == EINTR)
2307  continue;
2308 
2310  "select");
2311 #if USE_LSOF
2312  char lsof[512];
2313 
2314  snprintf(lsof,
2315  sizeof(lsof),
2316  "lsof -p %d",
2317  getpid());
2318  (void)close(1);
2319  (void)dup2(2, 1);
2320  if (0 != system(lsof))
2322  "system");
2323 #endif
2324 #if DEBUG_FDS
2325  for (struct Scheduled *s = context->scheduled_head;
2326  NULL != s;
2327  s = s->next)
2328  {
2329  int flags = fcntl(s->fdi->sock,
2330  F_GETFD);
2331 
2332  if ((flags == -1) &&
2333  (EBADF == errno))
2334  {
2336  "Got invalid file descriptor %d!\n",
2337  s->fdi->sock);
2338 #if EXECINFO
2339  dump_backtrace(s->task);
2340 #endif
2341  }
2342  }
2343 #endif
2344  GNUNET_assert(0);
2347  return GNUNET_SYSERR;
2348  }
2349  if (select_result > 0)
2350  {
2351  for (struct Scheduled *pos = context->scheduled_head;
2352  NULL != pos;
2353  pos = pos->next)
2354  {
2355  int is_ready = GNUNET_NO;
2356 
2357  if (0 != (GNUNET_SCHEDULER_ET_IN & pos->et) &&
2358  GNUNET_YES ==
2360  pos->fdi->sock))
2361  {
2362  pos->fdi->et |= GNUNET_SCHEDULER_ET_IN;
2363  is_ready = GNUNET_YES;
2364  }
2365  if (0 != (GNUNET_SCHEDULER_ET_OUT & pos->et) &&
2366  GNUNET_YES ==
2368  pos->fdi->sock))
2369  {
2370  pos->fdi->et |= GNUNET_SCHEDULER_ET_OUT;
2371  is_ready = GNUNET_YES;
2372  }
2373  if (GNUNET_YES == is_ready)
2374  {
2375  GNUNET_SCHEDULER_task_ready(pos->task,
2376  pos->fdi);
2377  }
2378  }
2379  }
2381  {
2383  "scheduler has more tasks ready!\n");
2384  }
2385  }
2388  return GNUNET_OK;
2389 }
void GNUNET_NETWORK_fdset_set_native(struct GNUNET_NETWORK_FDSet *to, int nfd)
Set a native fd in a set.
Definition: network.c:1125
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static GNUNET_SCHEDULER_select scheduler_select
Function to use as a select() in the scheduler.
Definition: scheduler.c:405
int GNUNET_NETWORK_fdset_test_native(const struct GNUNET_NETWORK_FDSet *to, int nfd)
Test native fd in a set.
Definition: network.c:1143
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
struct Scheduled * scheduled_head
the head of a DLL containing information about the events the select driver is waiting for ...
Definition: scheduler.c:282
uint64_t abs_value_us
The actual value.
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
void GNUNET_NETWORK_fdset_destroy(struct GNUNET_NETWORK_FDSet *fds)
Releases the associated memory of an fd set.
Definition: network.c:1254
struct GNUNET_NETWORK_FDSet * GNUNET_NETWORK_fdset_create(void)
Creates an fd set.
Definition: network.c:1238
collection of IO descriptors
A struct representing an event the select driver is waiting for.
Definition: scheduler.c:250
Buffer available for writing.
#define LOG_STRERROR(kind, syscall)
Definition: scheduler.c:33
int GNUNET_NETWORK_socket_select(struct GNUNET_NETWORK_FDSet *rfds, struct GNUNET_NETWORK_FDSet *wfds, struct GNUNET_NETWORK_FDSet *efds, struct GNUNET_TIME_Relative timeout)
Check if sockets meet certain conditions.
Definition: network.c:1328
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
Data available for reading.
#define LOG(kind,...)
Definition: scheduler.c:31
void GNUNET_NETWORK_fdset_zero(struct GNUNET_NETWORK_FDSet *fds)
Reset FD set (clears all file descriptors).
Definition: network.c:985
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...
Definition: scheduler.c:1947
struct GNUNET_TIME_Absolute timeout
the time when the select driver will wake up again (after calling select)
Definition: scheduler.c:294
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Definition: time.c:331
#define GNUNET_YES
Definition: gnunet_common.h:77
static void dump_backtrace(struct GNUNET_SCHEDULER_Task *t)
Output stack trace of task t.
Definition: scheduler.c:550
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 d...
Definition: scheduler.c:1902
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
Definition: strings.c:741
struct Scheduled * next
Definition: scheduler.c:253
static void * scheduler_select_cls
Closure for scheduler_select.
Definition: scheduler.c:415
Time for relative time used by GNUnet, in microseconds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_fd_info()

void init_fd_info ( struct GNUNET_SCHEDULER_Task t,
const struct GNUNET_NETWORK_Handle *const *  read_nh,
unsigned int  read_nh_len,
const struct GNUNET_NETWORK_Handle *const *  write_nh,
unsigned int  write_nh_len,
const struct GNUNET_DISK_FileHandle *const *  read_fh,
unsigned int  read_fh_len,
const struct GNUNET_DISK_FileHandle *const *  write_fh,
unsigned int  write_fh_len 
)

Definition at line 772 of file scheduler.c.

References GNUNET_SCHEDULER_FdInfo::et, GNUNET_SCHEDULER_FdInfo::fd, GNUNET_SCHEDULER_Task::fds, GNUNET_SCHEDULER_Task::fds_len, GNUNET_SCHEDULER_Task::fdx, GNUNET_SCHEDULER_FdInfo::fh, GNUNET_assert, GNUNET_NETWORK_get_fd(), GNUNET_new_array, GNUNET_SCHEDULER_ET_IN, GNUNET_SCHEDULER_ET_OUT, GNUNET_SCHEDULER_Task::read_fd, GNUNET_SCHEDULER_FdInfo::sock, and GNUNET_SCHEDULER_Task::write_fd.

Referenced by add_without_sets(), and GNUNET_SCHEDULER_add_select().

781 {
782  // FIXME: if we have exactly two network handles / exactly two file handles
783  // and they are equal, we can make one FdInfo with both
784  // GNUNET_SCHEDULER_ET_IN and GNUNET_SCHEDULER_ET_OUT set.
785  struct GNUNET_SCHEDULER_FdInfo *fdi;
786 
787  t->fds_len = read_nh_len + write_nh_len + read_fh_len + write_fh_len;
788  if (1 == t->fds_len)
789  {
790  fdi = &t->fdx;
791  t->fds = fdi;
792  if (1 == read_nh_len)
793  {
794  GNUNET_assert(NULL != read_nh);
795  GNUNET_assert(NULL != *read_nh);
796  fdi->fd = *read_nh;
797  fdi->et = GNUNET_SCHEDULER_ET_IN;
798  fdi->sock = GNUNET_NETWORK_get_fd(*read_nh);
799  t->read_fd = fdi->sock;
800  t->write_fd = -1;
801  }
802  else if (1 == write_nh_len)
803  {
804  GNUNET_assert(NULL != write_nh);
805  GNUNET_assert(NULL != *write_nh);
806  fdi->fd = *write_nh;
808  fdi->sock = GNUNET_NETWORK_get_fd(*write_nh);
809  t->read_fd = -1;
810  t->write_fd = fdi->sock;
811  }
812  else if (1 == read_fh_len)
813  {
814  GNUNET_assert(NULL != read_fh);
815  GNUNET_assert(NULL != *read_fh);
816  fdi->fh = *read_fh;
817  fdi->et = GNUNET_SCHEDULER_ET_IN;
818  fdi->sock = (*read_fh)->fd; // FIXME: does not work under WIN32
819  t->read_fd = fdi->sock;
820  t->write_fd = -1;
821  }
822  else
823  {
824  GNUNET_assert(NULL != write_fh);
825  GNUNET_assert(NULL != *write_fh);
826  fdi->fh = *write_fh;
828  fdi->sock = (*write_fh)->fd; // FIXME: does not work under WIN32
829  t->read_fd = -1;
830  t->write_fd = fdi->sock;
831  }
832  }
833  else
834  {
836  t->fds = fdi;
837  t->read_fd = -1;
838  t->write_fd = -1;
839  unsigned int i;
840  for (i = 0; i != read_nh_len; ++i)
841  {
842  fdi->fd = read_nh[i];
843  GNUNET_assert(NULL != fdi->fd);
844  fdi->et = GNUNET_SCHEDULER_ET_IN;
845  fdi->sock = GNUNET_NETWORK_get_fd(read_nh[i]);
846  ++fdi;
847  }
848  for (i = 0; i != write_nh_len; ++i)
849  {
850  fdi->fd = write_nh[i];
851  GNUNET_assert(NULL != fdi->fd);
853  fdi->sock = GNUNET_NETWORK_get_fd(write_nh[i]);
854  ++fdi;
855  }
856  for (i = 0; i != read_fh_len; ++i)
857  {
858  fdi->fh = read_fh[i];
859  GNUNET_assert(NULL != fdi->fh);
860  fdi->et = GNUNET_SCHEDULER_ET_IN;
861  fdi->sock = (read_fh[i])->fd; // FIXME: does not work under WIN32
862  ++fdi;
863  }
864  for (i = 0; i != write_fh_len; ++i)
865  {
866  fdi->fh = write_fh[i];
867  GNUNET_assert(NULL != fdi->fh);
869  fdi->sock = (write_fh[i])->fd; // FIXME: does not work under WIN32
870  ++fdi;
871  }
872  }
873 }
int GNUNET_NETWORK_get_fd(const struct GNUNET_NETWORK_Handle *desc)
Return file descriptor for this network handle.
Definition: network.c:1068
int read_fd
Set if we only wait for reading from a single FD, otherwise -1.
Definition: scheduler.c:204
Information about an event relating to a file descriptor/socket.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int write_fd
Set if we only wait for writing to a single FD, otherwise -1.
Definition: scheduler.c:209
struct GNUNET_SCHEDULER_FdInfo fdx
Storage location used for fds if we want to avoid a separate malloc() call in the common case that th...
Definition: scheduler.c:162
int sock
Underlying OS handle the event was about.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
const struct GNUNET_DISK_FileHandle * fh
GNUnet file handle the event is about, matches sock, NULL if this is about a network socket or if no ...
const struct GNUNET_NETWORK_Handle * fd
GNUnet network socket the event is about, matches sock, NULL if this is about a file handle or if no ...
Buffer available for writing.
struct GNUNET_SCHEDULER_FdInfo * fds
Information about which FDs are ready for this task (and why).
Definition: scheduler.c:155
Data available for reading.
enum GNUNET_SCHEDULER_EventType et
Type of the event that was generated related to sock.
unsigned int fds_len
Size of the fds array.
Definition: scheduler.c:167
Here is the call graph for this function:
Here is the caller graph for this function:

◆ driver_add_multiple()

static void driver_add_multiple ( struct GNUNET_SCHEDULER_Task t)
static

calls the given function func on each FdInfo related to t.

Optionally updates the event type field in each FdInfo after calling func.

Parameters
tthe task
driver_functhe function to call with each FdInfo contained in in t
if_not_readyonly call driver_func on FdInfos that are not ready
etthe event type to be set in each FdInfo after calling driver_func on it, or -1 if no updating not desired.

Definition at line 890 of file scheduler.c.

References GNUNET_SCHEDULER_Driver::add, GNUNET_SCHEDULER_Driver::cls, GNUNET_SCHEDULER_FdInfo::et, GNUNET_SCHEDULER_Task::fds, GNUNET_SCHEDULER_Task::fds_len, GNUNET_ERROR_TYPE_ERROR, GNUNET_SCHEDULER_ET_NONE, GNUNET_YES, and LOG.

Referenced by add_without_sets(), and GNUNET_SCHEDULER_add_select().

891 {
892  struct GNUNET_SCHEDULER_FdInfo *fdi;
893  int success = GNUNET_YES;
894 
895  for (unsigned int i = 0; i != t->fds_len; ++i)
896  {
897  fdi = &t->fds[i];
899  t,
900  fdi) && success;
902  }
903  if (GNUNET_YES != success)
904  {
906  "driver could not add task\n");
907  }
908 }
Information about an event relating to a file descriptor/socket.
static const struct GNUNET_SCHEDULER_Driver * scheduler_driver
The driver used for the event loop.
Definition: scheduler.c:305
struct GNUNET_SCHEDULER_FdInfo * fds
Information about which FDs are ready for this task (and why).
Definition: scheduler.c:155
#define LOG(kind,...)
Definition: scheduler.c:31
int(* add)(void *cls, struct GNUNET_SCHEDULER_Task *task, struct GNUNET_SCHEDULER_FdInfo *fdi)
Add a task to be run if the conditions specified in the et field of the given fdi are satisfied...
enum GNUNET_SCHEDULER_EventType et
Type of the event that was generated related to sock.
unsigned int fds_len
Size of the fds array.
Definition: scheduler.c:167
No event (useful for timeout).
void * cls
Closure to pass to the functions in this struct.
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the caller graph for this function:

◆ install_parent_control_handler()

static void install_parent_control_handler ( void *  cls)
static

Definition at line 912 of file scheduler.c.

References GNUNET_OS_install_parent_control_handler().

Referenced by GNUNET_SCHEDULER_driver_init().

913 {
914  (void)cls;
917 }
static struct GNUNET_SCHEDULER_Task * install_parent_control_task
Task for installing parent control handlers (it might happen that the scheduler is shutdown before th...
Definition: scheduler.c:371
void GNUNET_OS_install_parent_control_handler(void *cls)
Connects this process to its parent via pipe; essentially, the parent control handler will read signa...
Definition: os_priority.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown_pipe_cb()

static void shutdown_pipe_cb ( void *  cls)
static

Definition at line 921 of file scheduler.c.

References GNUNET_assert, GNUNET_DISK_file_read(), GNUNET_DISK_handle_invalid(), GNUNET_DISK_PIPE_END_READ, GNUNET_DISK_pipe_handle(), GNUNET_SCHEDULER_add_read_file(), GNUNET_SCHEDULER_shutdown(), and GNUNET_TIME_UNIT_FOREVER_REL.

Referenced by GNUNET_SCHEDULER_driver_init().

922 {
923  char c;
924  const struct GNUNET_DISK_FileHandle *pr;
925 
926  (void)cls;
927  shutdown_pipe_task = NULL;
931  /* consume the signal */
932  GNUNET_DISK_file_read(pr, &c, sizeof(c));
933  /* mark all active tasks as ready due to shutdown */
937  pr,
939  NULL);
940 }
ssize_t GNUNET_DISK_file_read(const struct GNUNET_DISK_FileHandle *h, void *result, size_t len)
Read the contents of a binary file into a buffer.
Definition: disk.c:729
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_DISK_PipeHandle * shutdown_pipe_handle
Pipe used to communicate shutdown via signal.
Definition: scheduler.c:611
struct GNUNET_SCHEDULER_Task * GNUNET_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 f...
Definition: scheduler.c:1615
void GNUNET_SCHEDULER_shutdown()
Request the shutdown of a scheduler.
Definition: scheduler.c:517
int GNUNET_DISK_handle_invalid(const struct GNUNET_DISK_FileHandle *h)
Checks whether a handle is invalid.
Definition: disk.c:190
const struct GNUNET_DISK_FileHandle * GNUNET_DISK_pipe_handle(const struct GNUNET_DISK_PipeHandle *p, enum GNUNET_DISK_PipeEnd n)
Get the handle to a particular pipe end.
Definition: disk.c:1744
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
The reading-end of a pipe.
static struct GNUNET_SCHEDULER_Task * shutdown_pipe_task
Task for reading from a pipe that signal handlers will use to initiate shutdown.
Definition: scheduler.c:377
static void shutdown_pipe_cb(void *cls)
Definition: scheduler.c:921
Handle used to access files (and pipes).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_backtrace()

static void init_backtrace ( struct GNUNET_SCHEDULER_Task t)
static

Initialize backtrace data for task t.

Parameters
ttask to initialize

Definition at line 1022 of file scheduler.c.

References dump_backtrace().

Referenced by add_without_sets(), GNUNET_SCHEDULER_add_at_with_priority(), GNUNET_SCHEDULER_add_now_with_lifeness(), GNUNET_SCHEDULER_add_select(), GNUNET_SCHEDULER_add_shutdown(), and GNUNET_SCHEDULER_add_with_reason_and_priority().

1023 {
1024 #if EXECINFO
1025  void *backtrace_array[MAX_TRACE_DEPTH];
1026 
1027  t->num_backtrace_strings
1028  = backtrace(backtrace_array, MAX_TRACE_DEPTH);
1029  t->backtrace_strings =
1030  backtrace_symbols(backtrace_array,
1031  t->num_backtrace_strings);
1032  dump_backtrace(t);
1033 #else
1034  (void)t;
1035 #endif
1036 }
static void dump_backtrace(struct GNUNET_SCHEDULER_Task *t)
Output stack trace of task t.
Definition: scheduler.c:550
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_without_sets()

static struct GNUNET_SCHEDULER_Task* add_without_sets ( struct GNUNET_TIME_Relative  delay,
enum GNUNET_SCHEDULER_Priority  priority,
const struct GNUNET_NETWORK_Handle read_nh,
const struct GNUNET_NETWORK_Handle write_nh,
const struct GNUNET_DISK_FileHandle read_fh,
const struct GNUNET_DISK_FileHandle write_fh,
GNUNET_SCHEDULER_TaskCallback  task,
void *  task_cls 
)
static

Schedule a new task to be run with a specified delay or when any of the specified file descriptor sets is ready.

The delay can be used as a timeout on the socket(s) being ready. The task will be scheduled for execution once either the delay has expired or any of the socket operations is ready. This is the most general function of the "add" family. Note that the "prerequisite_task" must be satisfied in addition to any of the other conditions. In other words, the task will be started when (prerequisite-run) && (delay-ready || any-rs-ready || any-ws-ready)

Parameters
delayhow long should we wait?
prioritypriority to use
rfdfile descriptor we want to read (can be -1)
wfdfile descriptors we want to write (can be -1)
taskmain function of the task
task_clsclosure of task
Returns
unique task identifier for the job only valid until task is started!

Definition at line 1396 of file scheduler.c.

References GNUNET_SCHEDULER_Task::callback, GNUNET_SCHEDULER_Task::callback_cls, check_priority(), current_lifeness, current_priority, driver_add_multiple(), GNUNET_DISK_FileHandle::fd, GNUNET_assert, GNUNET_async_scope_get(), GNUNET_CONTAINER_DLL_insert, GNUNET_MAX, GNUNET_NETWORK_get_fd(), GNUNET_new, GNUNET_SCHEDULER_PRIORITY_KEEP, GNUNET_TIME_absolute_get(), GNUNET_TIME_relative_to_absolute(), init_backtrace(), init_fd_info(), GNUNET_SCHEDULER_Task::lifeness, max_priority_added, GNUNET_SCHEDULER_Task::priority, GNUNET_SCHEDULER_Task::scope, t, and GNUNET_SCHEDULER_Task::timeout.

Referenced by GNUNET_SCHEDULER_add_file_with_priority(), and GNUNET_SCHEDULER_add_net_with_priority().

1404 {
1405  struct GNUNET_SCHEDULER_Task *t;
1406 
1407  /* scheduler must be running */
1409  GNUNET_assert(NULL != task);
1410  t = GNUNET_new(struct GNUNET_SCHEDULER_Task);
1412  init_fd_info(t,
1413  &read_nh,
1414  read_nh ? 1 : 0,
1415  &write_nh,
1416  write_nh ? 1 : 0,
1417  &read_fh,
1418  read_fh ? 1 : 0,
1419  &write_fh,
1420  write_fh ? 1 : 0);
1421  t->callback = task;
1422  t->callback_cls = task_cls;
1423 #if DEBUG_FDS
1424  check_fd(t, NULL != read_nh ? GNUNET_NETWORK_get_fd(read_nh) : -1);
1425  check_fd(t, NULL != write_nh ? GNUNET_NETWORK_get_fd(write_nh) : -1);
1426  check_fd(t, NULL != read_fh ? read_fh->fd : -1);
1427  check_fd(t, NULL != write_fh ? write_fh->fd : -1);
1428 #endif
1429 #if PROFILE_DELAYS
1430  t->start_time = GNUNET_TIME_absolute_get();
1431 #endif
1436  pending_tail,
1437  t);
1440  t->priority);
1441  init_backtrace(t);
1442  return t;
1443 }
int GNUNET_NETWORK_get_fd(const struct GNUNET_NETWORK_Handle *desc)
Return file descriptor for this network handle.
Definition: network.c:1068
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
GNUNET_SCHEDULER_TaskCallback callback
Function to run when ready.
Definition: scheduler.c:145
struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel)
Convert relative time to an absolute time in the future.
Definition: time.c:246
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void init_backtrace(struct GNUNET_SCHEDULER_Task *t)
Initialize backtrace data for task t.
Definition: scheduler.c:1022
Run with the same priority as the current job.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static struct GNUNET_SCHEDULER_Task * pending_head
Head of list of tasks waiting for an event.
Definition: scheduler.c:310
static struct GNUNET_SCHEDULER_Task * t
Main task.
static struct GNUNET_SCHEDULER_Task * pending_tail
Tail of list of tasks waiting for an event.
Definition: scheduler.c:315
#define GNUNET_MAX(a, b)
Definition: gnunet_common.h:82
static int current_lifeness
Value of the &#39;lifeness&#39; flag for the current task.
Definition: scheduler.c:399
static void driver_add_multiple(struct GNUNET_SCHEDULER_Task *t)
calls the given function func on each FdInfo related to t.
Definition: scheduler.c:890
static const struct GNUNET_SCHEDULER_Driver * scheduler_driver
The driver used for the event loop.
Definition: scheduler.c:305
void GNUNET_async_scope_get(struct GNUNET_AsyncScopeSave *scope_ret)
Get the current async scope.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
void * callback_cls
Closure for the callback.
Definition: scheduler.c:150
static enum GNUNET_SCHEDULER_Priority current_priority
Priority of the task running right now.
Definition: scheduler.c:388
static enum GNUNET_SCHEDULER_Priority max_priority_added
Priority of the highest task added in the current select iteration.
Definition: scheduler.c:394
static enum GNUNET_SCHEDULER_Priority check_priority(enum GNUNET_SCHEDULER_Priority p)
Check that the given priority is legal (and return it).
Definition: scheduler.c:441
Entry in list of pending tasks.
Definition: scheduler.c:131
void init_fd_info(struct GNUNET_SCHEDULER_Task *t, const struct GNUNET_NETWORK_Handle *const *read_nh, unsigned int read_nh_len, const struct GNUNET_NETWORK_Handle *const *write_nh, unsigned int write_nh_len, const struct GNUNET_DISK_FileHandle *const *read_fh, unsigned int read_fh_len, const struct GNUNET_DISK_FileHandle *const *write_fh, unsigned int write_fh_len)
Definition: scheduler.c:772
struct GNUNET_TIME_Absolute timeout
Absolute timeout value for the task, or GNUNET_TIME_UNIT_FOREVER_ABS for "no timeout".
Definition: scheduler.c:180
enum GNUNET_SCHEDULER_Priority priority
Task priority.
Definition: scheduler.c:199
int fd
File handle on Unix-like systems.
struct GNUNET_AsyncScopeSave scope
Asynchronous scope of the task that scheduled this scope,.
Definition: scheduler.c:243
int lifeness
Should the existence of this task in the queue be counted as reason to not shutdown the scheduler...
Definition: scheduler.c:215
Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_handles()

void extract_handles ( const struct GNUNET_NETWORK_FDSet fdset,
const struct GNUNET_NETWORK_Handle ***  ntarget,
unsigned int *  extracted_nhandles,
const struct GNUNET_DISK_FileHandle ***  ftarget,
unsigned int *  extracted_fhandles 
)

Definition at line 1702 of file scheduler.c.

References GNUNET_array_append, GNUNET_assert, GNUNET_DISK_get_handle_from_int_fd(), GNUNET_NETWORK_fdset_test_native(), GNUNET_NETWORK_socket_box_native(), GNUNET_YES, and GNUNET_NETWORK_FDSet::nsds.

Referenced by GNUNET_SCHEDULER_add_select().

1707 {
1708  // FIXME: this implementation only works for unix, for WIN32 the file handles
1709  // in fdset must be handled separately
1710  const struct GNUNET_NETWORK_Handle **nhandles;
1711  const struct GNUNET_DISK_FileHandle **fhandles;
1712  unsigned int nhandles_len;
1713  unsigned int fhandles_len;
1714 
1715  nhandles = NULL;
1716  fhandles = NULL;
1717  nhandles_len = 0;
1718  fhandles_len = 0;
1719  for (int sock = 0; sock != fdset->nsds; ++sock)
1720  {
1721  if (GNUNET_YES == GNUNET_NETWORK_fdset_test_native(fdset, sock))
1722  {
1723  struct GNUNET_NETWORK_Handle *nhandle;
1724  struct GNUNET_DISK_FileHandle *fhandle;
1725 
1726  nhandle = GNUNET_NETWORK_socket_box_native(sock);
1727  if (NULL != nhandle)
1728  {
1729  GNUNET_array_append(nhandles, nhandles_len, nhandle);
1730  }
1731  else
1732  {
1733  fhandle = GNUNET_DISK_get_handle_from_int_fd(sock);
1734  if (NULL != fhandle)
1735  {
1736  GNUNET_array_append(fhandles, fhandles_len, fhandle);
1737  }
1738  else
1739  {
1740  GNUNET_assert(0);
1741  }
1742  }
1743  }
1744  }
1745  *ntarget = nhandles_len > 0 ? nhandles : NULL;
1746  *ftarget = fhandles_len > 0 ? fhandles : NULL;
1747  *extracted_nhandles = nhandles_len;
1748  *extracted_fhandles = fhandles_len;
1749 }
int nsds
Maximum number of any socket descriptor in the set (plus one)
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int GNUNET_NETWORK_fdset_test_native(const struct GNUNET_NETWORK_FDSet *to, int nfd)
Test native fd in a set.
Definition: network.c:1143
struct GNUNET_NETWORK_Handle * GNUNET_NETWORK_socket_box_native(SOCKTYPE fd)
Box a native socket (and check that it is a socket).
Definition: network.c:624
#define GNUNET_array_append(arr, size, element)
Append an element to a list (growing the list by one).
struct GNUNET_DISK_FileHandle * GNUNET_DISK_get_handle_from_int_fd(int fno)
Get a handle from a native integer FD.
Definition: disk.c:1369
handle to a socket
Definition: network.c:46
#define GNUNET_YES
Definition: gnunet_common.h:77
Handle used to access files (and pipes).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ select_add()

static int select_add ( void *  cls,
struct GNUNET_SCHEDULER_Task task,
struct GNUNET_SCHEDULER_FdInfo fdi 
)
static

Definition at line 2393 of file scheduler.c.

References GNUNET_SCHEDULER_FdInfo::et, Scheduled::et, GNUNET_SCHEDULER_FdInfo::fd, Scheduled::fdi, GNUNET_SCHEDULER_FdInfo::fh, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_OK, GNUNET_SCHEDULER_ET_IN, GNUNET_SCHEDULER_ET_OUT, GNUNET_SYSERR, DriverContext::scheduled_head, DriverContext::scheduled_tail, GNUNET_SCHEDULER_FdInfo::sock, and Scheduled::task.

Referenced by GNUNET_SCHEDULER_driver_select().

2396 {
2397  struct DriverContext *context = cls;
2398 
2399  GNUNET_assert(NULL != context);
2400  GNUNET_assert(NULL != task);
2401  GNUNET_assert(NULL != fdi);
2402  GNUNET_assert(0 != (GNUNET_SCHEDULER_ET_IN & fdi->et) ||
2403  0 != (GNUNET_SCHEDULER_ET_OUT & fdi->et));
2404 
2405  if (!((NULL != fdi->fd) ^ (NULL != fdi->fh)) || (fdi->sock < 0))
2406  {
2407  /* exactly one out of {fd, hf} must be != NULL and the OS handle must be valid */
2408  return GNUNET_SYSERR;
2409  }
2410 
2411  struct Scheduled *scheduled = GNUNET_new(struct Scheduled);
2412  scheduled->task = task;
2413  scheduled->fdi = fdi;
2414  scheduled->et = fdi->et;
2415 
2417  context->scheduled_tail,
2418  scheduled);
2419  return GNUNET_OK;
2420 }
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct Scheduled * scheduled_head
the head of a DLL containing information about the events the select driver is waiting for ...
Definition: scheduler.c:282
static pa_context * context
Pulseaudio context.
Driver context used by GNUNET_SCHEDULER_run.
Definition: scheduler.c:277
struct GNUNET_SCHEDULER_FdInfo * fdi
information about the network socket / file descriptor where the event is expected to occur ...
Definition: scheduler.c:264
int sock
Underlying OS handle the event was about.
const struct GNUNET_DISK_FileHandle * fh
GNUnet file handle the event is about, matches sock, NULL if this is about a network socket or if no ...
const struct GNUNET_NETWORK_Handle * fd
GNUnet network socket the event is about, matches sock, NULL if this is about a file handle or if no ...
A struct representing an event the select driver is waiting for.
Definition: scheduler.c:250
Buffer available for writing.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
Data available for reading.
enum GNUNET_SCHEDULER_EventType et
Type of the event that was generated related to sock.
struct Scheduled * scheduled_tail
the tail of a DLL containing information about the events the select driver is waiting for ...
Definition: scheduler.c:288
struct GNUNET_SCHEDULER_Task * task
the task, the event is related to
Definition: scheduler.c:258
enum GNUNET_SCHEDULER_EventType et
the event types (multiple event types can be ORed) the select driver is expected to wait for ...
Definition: scheduler.c:270
Here is the caller graph for this function:

◆ select_del()

static int select_del ( void *  cls,
struct GNUNET_SCHEDULER_Task task 
)
static

Definition at line 2424 of file scheduler.c.

References context, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_OK, GNUNET_SYSERR, Scheduled::next, ret, DriverContext::scheduled_head, DriverContext::scheduled_tail, and Scheduled::task.

Referenced by GNUNET_SCHEDULER_driver_select().

2426 {
2427  struct DriverContext *context;
2428  struct Scheduled *pos;
2429  int ret;
2430 
2431  GNUNET_assert(NULL != cls);
2432 
2433  context = cls;
2434  ret = GNUNET_SYSERR;
2435  pos = context->scheduled_head;
2436  while (NULL != pos)
2437  {
2438  struct Scheduled *next = pos->next;
2439  if (pos->task == task)
2440  {
2442  context->scheduled_tail,
2443  pos);
2444  GNUNET_free(pos);
2445  ret = GNUNET_OK;
2446  }
2447  pos = next;
2448  }
2449  return ret;
2450 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
struct Scheduled * scheduled_head
the head of a DLL containing information about the events the select driver is waiting for ...
Definition: scheduler.c:282
static int ret
Final status code.
Definition: gnunet-arm.c:89
static pa_context * context
Pulseaudio context.
Driver context used by GNUNET_SCHEDULER_run.
Definition: scheduler.c:277
A struct representing an event the select driver is waiting for.
Definition: scheduler.c:250
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
struct Scheduled * scheduled_tail
the tail of a DLL containing information about the events the select driver is waiting for ...
Definition: scheduler.c:288
struct GNUNET_SCHEDULER_Task * task
the task, the event is related to
Definition: scheduler.c:258
struct Scheduled * next
Definition: scheduler.c:253
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ select_set_wakeup()

static void select_set_wakeup ( void *  cls,
struct GNUNET_TIME_Absolute  dt 
)
static

Definition at line 2454 of file scheduler.c.

References GNUNET_assert, and DriverContext::timeout.

Referenced by GNUNET_SCHEDULER_driver_select().

2456 {
2457  struct DriverContext *context = cls;
2458 
2459  GNUNET_assert(NULL != context);
2460  context->timeout = dt;
2461 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static pa_context * context
Pulseaudio context.
Driver context used by GNUNET_SCHEDULER_run.
Definition: scheduler.c:277
struct GNUNET_TIME_Absolute timeout
the time when the select driver will wake up again (after calling select)
Definition: scheduler.c:294
Here is the caller graph for this function:

Variable Documentation

◆ scheduler_driver

const struct GNUNET_SCHEDULER_Driver* scheduler_driver
static

The driver used for the event loop.

Will be handed over to the scheduler in GNUNET_SCHEDULER_do_work(), persisted there in this variable for later use in functions like GNUNET_SCHEDULER_add_select(), add_without_sets() and GNUNET_SCHEDULER_cancel().

Definition at line 305 of file scheduler.c.

◆ pending_head

struct GNUNET_SCHEDULER_Task* pending_head
static

Head of list of tasks waiting for an event.

Definition at line 310 of file scheduler.c.

Referenced by GNUNET_SCHEDULER_do_work().

◆ pending_tail

struct GNUNET_SCHEDULER_Task* pending_tail
static

Tail of list of tasks waiting for an event.

Definition at line 315 of file scheduler.c.

◆ shutdown_head

struct GNUNET_SCHEDULER_Task* shutdown_head
static

Head of list of tasks waiting for shutdown.

Definition at line 320 of file scheduler.c.

◆ shutdown_tail

struct GNUNET_SCHEDULER_Task* shutdown_tail
static

Tail of list of tasks waiting for shutdown.

Definition at line 325 of file scheduler.c.

◆ pending_timeout_head

struct GNUNET_SCHEDULER_Task* pending_timeout_head
static

List of tasks waiting ONLY for a timeout event.

Sorted by timeout (earliest first). Used so that we do not traverse the list of these tasks when building select sets (we just look at the head to determine the respective timeout ONCE).

Definition at line 334 of file scheduler.c.

Referenced by get_timeout(), GNUNET_SCHEDULER_add_at_with_priority(), and GNUNET_SCHEDULER_do_work().

◆ pending_timeout_tail

struct GNUNET_SCHEDULER_Task* pending_timeout_tail
static

List of tasks waiting ONLY for a timeout event.

Sorted by timeout (earliest first). Used so that we do not traverse the list of these tasks when building select sets (we just look at the head to determine the respective timeout ONCE).

Definition at line 343 of file scheduler.c.

◆ pending_timeout_last

struct GNUNET_SCHEDULER_Task* pending_timeout_last
static

Last inserted task waiting ONLY for a timeout event.

Used to (heuristically) speed up insertion.

Definition at line 349 of file scheduler.c.

Referenced by GNUNET_SCHEDULER_add_at_with_priority().

◆ active_task

struct GNUNET_SCHEDULER_Task* active_task
static

ID of the task that is running right now.

Definition at line 354 of file scheduler.c.

◆ ready_head

Head of list of tasks ready to run right now, grouped by importance.

Definition at line 359 of file scheduler.c.

◆ ready_tail

Tail of list of tasks ready to run right now, grouped by importance.

Definition at line 364 of file scheduler.c.

◆ install_parent_control_task

struct GNUNET_SCHEDULER_Task* install_parent_control_task
static

Task for installing parent control handlers (it might happen that the scheduler is shutdown before this task is executed, so GNUNET_SCHEDULER_shutdown must cancel it in that case)

Definition at line 371 of file scheduler.c.

◆ shutdown_pipe_task

struct GNUNET_SCHEDULER_Task* shutdown_pipe_task
static

Task for reading from a pipe that signal handlers will use to initiate shutdown.

Definition at line 377 of file scheduler.c.

◆ ready_count

unsigned int ready_count
static

Number of tasks on the ready list.

Definition at line 382 of file scheduler.c.

Referenced by GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_do_work(), GNUNET_SCHEDULER_get_load(), queue_ready_task(), and shutdown_if_no_lifeness().

◆ current_priority

enum GNUNET_SCHEDULER_Priority current_priority
static

Priority of the task running right now.

Only valid while a task is running.

Definition at line 388 of file scheduler.c.

Referenced by add_without_sets(), GNUNET_SCHEDULER_add_select(), GNUNET_SCHEDULER_do_work(), GNUNET_SCHEDULER_driver_init(), and GNUNET_SCHEDULER_get_load().

◆ max_priority_added

enum GNUNET_SCHEDULER_Priority max_priority_added
static

Priority of the highest task added in the current select iteration.

Definition at line 394 of file scheduler.c.

Referenced by add_without_sets(), GNUNET_SCHEDULER_add_select(), and GNUNET_SCHEDULER_do_work().

◆ current_lifeness

int current_lifeness
static

◆ scheduler_select

GNUNET_SCHEDULER_select scheduler_select
static

Function to use as a select() in the scheduler.

If NULL, we use GNUNET_NETWORK_socket_select().

Definition at line 405 of file scheduler.c.

Referenced by GNUNET_SCHEDULER_set_select(), and select_loop().

◆ tc

struct GNUNET_SCHEDULER_TaskContext tc
static

Task context of the current task.

Definition at line 410 of file scheduler.c.

Referenced by add_to_tc(), check_add_address(), check_add_queue_message(), check_client_send(), check_communicator_available(), check_incoming_msg(), child_death_task(), client_connect_cb(), client_disconnect_cb(), client_send_response(), cmd_read(), connect_probe_continuation(), cores_send_connect_info(), cores_send_disconnect_info(), do_blacklist_check(), do_read(), do_s5r_read(), do_udp_read(), free_address_list_entry(), free_pending_message(), free_queue(), GNUNET_SCHEDULER_do_work(), GNUNET_SCHEDULER_get_task_context(), GST_blacklist_test_allowed(), GST_clients_broadcast(), GST_clients_broadcast_peer_notification(), handle_add_address(), handle_add_queue_message(), handle_backchannel_encapsulation(), handle_client_address_to_string(), handle_client_blacklist_init(), handle_client_blacklist_reply(), handle_client_hello(), handle_client_monitor_peers(), handle_client_monitor_plugins(), handle_client_recv_ok(), handle_client_send(), handle_client_set_metric(), handle_client_start(), handle_communicator_available(), handle_communicator_backchannel(), handle_del_address(), handle_del_queue_message(), handle_incoming_msg(), handle_monitor_start(), handle_queue_create_fail(), handle_queue_create_ok(), handle_raw_message(), handle_request_hello_validation(), handle_send_message_ack(), handle_suggest(), handle_suggest_cancel(), lookup_communicator(), maint_child_death(), mark_match_down(), migrate_and_drop_keywords(), migrate_and_drop_metadata(), notify_client_about_neighbour(), notify_client_connect_info(), notify_client_queues(), notify_monitors(), process_listen_socket(), read_dns4(), read_dns6(), read_response(), receive_ready(), remove_high_frequency_keywords(), stop_peer_request(), suggest_to_connect(), tcp_send(), tokenized_cb(), transmit_kx(), transmit_ready(), udp_plugin_select_v4(), udp_plugin_select_v6(), unix_plugin_select_read(), and unix_plugin_select_write().

◆ scheduler_select_cls

void* scheduler_select_cls
static

Closure for scheduler_select.

Definition at line 415 of file scheduler.c.

Referenced by GNUNET_SCHEDULER_set_select(), and select_loop().

◆ shutdown_pipe_handle

struct GNUNET_DISK_PipeHandle* shutdown_pipe_handle
static

Pipe used to communicate shutdown via signal.

Definition at line 611 of file scheduler.c.

◆ my_pid

pid_t my_pid
static

Process ID of this process at the time we installed the various signal handlers.

Definition at line 617 of file scheduler.c.

Referenced by GNUNET_SCHEDULER_driver_init(), and sighandler_shutdown().