1MAIL::ACCOUNT::PROCESS(m3axi)l::account Native API refereMnAcIeL::ACCOUNT::PROCESS(3x)
2
3
4

NAME

6       mail::account::process - Process pending events
7

SYNOPSIS

9       #include <libmail/mail.H>
10
11
12       class myCallback : public mail::callback {
13       public:
14           void success(std::string msg);
15           void fail(std::string msg);
16       };
17
18       #include <sys/time.h>
19       #include <sys/types.h>
20       #include <unistd.h>
21
22       mail::account::function( parameter list,
23                                myCallback &callback)
24
25       for (;;)
26       {
27         std::vector<mail::pollfd> pollfds;
28         int timeout;
29
30         timeout=15 * 60 * 60 * 1000;
31
32
33
34       mail::account::process (pollfds, timeout);
35
36
37         if (myCallback.completed())
38             break;
39
40         if (mail::account::poll(pollfds, timeout) < 0 && errno != EINTR)
41         {
42            error();
43         }
44       }
45

USAGE

47       This  function  processes  all  pending  events  for  all  opened  mail
48       accounts.  Most mail requests are not immediately processed (some  are,
49       but  most  aren't).   A mail request usually includes a mail::callback-
50       derived object as one of its arguments.  When  the  mail  request  com‐
51       pletes  the  success or fail method (some mail::callback subclasses use
52       additional or alternative methods) is invoked.   If  the  mail  request
53       cannot  be completed immediately, mail::account::function still returns
54       right away.  mail::account::process handles any pending events for  all
55       outstanding  mail requests.  The success or fail method will be invoked
56       for all completed requests.
57
58       The mail::pollfd structure is a C++ wrapper for the  ``struct  pollfd''
59       that's   used  by  the  poll(2)  system  call.   mail::account::process
60       receives a reference  to  a  vector  of  mail::pollfd  objects.   After
61       mail::account::process  handles  any  pending events, the function ini‐
62       tializes the vector with all open file descriptors on which activity is
63       expected  before  mail::account::process  expects  any  more  events to
64       occur.
65
66       Any existing contents of the mail::pollfd vector will be destroyed.  On
67       the   other  hand,  timeout  must  be  initialized  prior  to  invoking
68       mail::account::process.  timeout contains a time interval, in millisec‐
69       onds,  before the calling application expects to process any regularly-
70       scheduled event.   If  mail::account::process  expects  any  regularly-
71       scheduled  event  to  occur  earlier,  it will replace timeout with the
72       smaller timeout interval.
73
74       The expectation is that  the  application's  main  loops  alternatively
75       invokes mail::account::process and poll(2).  poll(2) waits for some I/O
76       occur, or a  timeout  expiring;  mail::account::process  processes  any
77       resulting events, then the cycle repeats.
78
79       The  application  may  add its own file descriptors to the mail::pollfd
80       vector, before calling poll(2).  The application is reponsible for han‐
81       dling any I/O activity from its own file descriptors.
82

RETURN CODES

84       mail::account::process always returns succesfully.
85
86              Note:  The  application should not invoke mail::account::process
87              again  until  it  either  invokes  poll(2)  (directly   or   via
88              mail::account::poll(3x)), or until the application calls another
89              LibMAIL function.
90

SEE ALSO

92       mail::account::open(3x),                       mail::account::poll(3x),
93       mail::account::resume(3x).
94
95
96
97                                 10 April 2006      MAIL::ACCOUNT::PROCESS(3x)
Impressum