~ubuntu-branches/ubuntu/trusty/postfix/trusty-updates

« back to all changes in this revision

Viewing changes to src/util/events.c

Tags: upstream-2.3.1
ImportĀ upstreamĀ versionĀ 2.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
/*      int     delay;
18
18
/*
19
19
/*      int     event_cancel_timer(callback, context)
20
 
/*      void    (*callback)(char *context);
 
20
/*      void    (*callback)(int event, char *context);
21
21
/*      char    *context;
22
22
/*
23
23
/*      void    event_enable_read(fd, callback, context)
63
63
/*      The event argument is equal to EVENT_TIME.
64
64
/*      Only one timer request can be active per (callback, context) pair.
65
65
/*      Calling event_request_timer() with an existing (callback, context)
66
 
/*      pair does not schedule a new event, but updates the moment of
 
66
/*      pair does not schedule a new event, but updates the time of event
67
67
/*      delivery. The result is the absolute time at which the timer is
68
68
/*      scheduled to go off.
69
69
/*
273
273
 
274
274
void    event_enable_read(int fd, EVENT_NOTIFY_RDWR callback, char *context)
275
275
{
276
 
    char   *myname = "event_enable_read";
 
276
    const char *myname = "event_enable_read";
277
277
    EVENT_FDTABLE *fdp;
278
278
 
279
279
    if (EVENT_INIT_NEEDED())
312
312
 
313
313
void    event_enable_write(int fd, EVENT_NOTIFY_RDWR callback, char *context)
314
314
{
315
 
    char   *myname = "event_enable_write";
 
315
    const char *myname = "event_enable_write";
316
316
    EVENT_FDTABLE *fdp;
317
317
 
318
318
    if (EVENT_INIT_NEEDED())
351
351
 
352
352
void    event_disable_readwrite(int fd)
353
353
{
354
 
    char   *myname = "event_disable_readwrite";
 
354
    const char *myname = "event_disable_readwrite";
355
355
    EVENT_FDTABLE *fdp;
356
356
 
357
357
    if (EVENT_INIT_NEEDED())
382
382
 
383
383
time_t  event_request_timer(EVENT_NOTIFY_TIME callback, char *context, int delay)
384
384
{
385
 
    char   *myname = "event_request_timer";
 
385
    const char *myname = "event_request_timer";
386
386
    RING   *ring;
387
387
    EVENT_TIMER *timer;
388
388
 
446
446
 
447
447
int     event_cancel_timer(EVENT_NOTIFY_TIME callback, char *context)
448
448
{
449
 
    char   *myname = "event_cancel_timer";
 
449
    const char *myname = "event_cancel_timer";
450
450
    RING   *ring;
451
451
    EVENT_TIMER *timer;
452
452
    int     time_left = -1;
479
479
 
480
480
void    event_loop(int delay)
481
481
{
482
 
    char   *myname = "event_loop";
 
482
    const char *myname = "event_loop";
483
483
    static int nested;
484
484
    fd_set  rmask;
485
485
    fd_set  wmask;
613
613
#ifdef TEST
614
614
 
615
615
 /*
616
 
  * Proof-of-concept test program for the event manager. Schedule a series
617
 
of events at one-second intervals and let them happen,
618
 
  while echoing any lines read from stdin. 
 
616
  * Proof-of-concept test program for the event manager. Schedule a series of
 
617
  * events at one-second intervals and let them happen, while echoing any
 
618
  * lines read from stdin.
619
619
  */
620
620
#include <stdio.h>
621
621
#include <ctype.h>
 
622
#include <stdlib.h>
622
623
 
623
624
/* timer_event - display event */
624
625
 
639
640
    printf("Result: %s", buf);
640
641
}
641
642
 
642
 
int main(void)
 
643
int     main(void)
643
644
{
644
645
    event_request_timer(timer_event, "3 first", 3);
645
646
    event_request_timer(timer_event, "3 second", 3);