Category Archives: Event management

How Orchids inputs, dissects and monitors events

gettimeofday() and ctx->cur_loop_time

The event manager keeps track of the current time in the cur_loop_time field of the Orchids context. When you want to reschedule an event to take place in, say, 5 seconds, it is tempting to write:

  heap_entry_t *he;

  /* ... */
  he->date = ctx->cur_loop_time + 5;
  register_rtaction(ctx, he);

This post explains why this is a bad idea, and how it should be done. Continue reading