1        Cone©
2
3MAIL::ACCOUNT::PROCE(3x)Cone: COnsole Newsreader And EMAIL::ACCOUNT::PROCE(3x)
4
5
6

NAME

8       mail::account::process - Process pending events
9

SYNOPSIS

11       #include <libmail/mail.H>
12
13
14       class myCallback : public mail::callback {
15       public:
16           void success(std::string msg);
17           void fail(std::string msg);
18       };
19
20       #include <sys/time.h>
21       #include <sys/types.h>
22       #include <unistd.h>
23
24       mail::account::function( parameter list,
25                                myCallback &callback)
26
27       for (;;)
28       {
29         std::vector<mail::pollfd> pollfds;
30         int timeout;
31
32         timeout=15 * 60 * 60 * 1000;
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
50       mail::callback-derived object as one of its arguments. When the mail
51       request completes the success or fail method (some mail::callback
52       subclasses use additional or alternative methods) is invoked. If the
53       mail request cannot be completed immediately, mail::account::function
54       still returns right away.  mail::account::process handles any pending
55       events for all outstanding mail requests. The success or fail method
56       will be invoked 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
62       initializes the vector with all open file descriptors on which activity
63       is 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
69       milliseconds, before the calling application expects to process any
70       regularly-scheduled event. If mail::account::process expects any
71       regularly-scheduled event to occur earlier, it will replace timeout
72       with the 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
81       handling any I/O activity from its own file descriptors.
82

RETURN CODES

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

SEE ALSO

93       mail::account::open(3x), mail::account::poll(3x),
94       mail::account::resume(3x).
95

AUTHOR

97       Sam Varshavchik
98
99
100
101Cone©                             08/25/2016          MAIL::ACCOUNT::PROCE(3x)
Impressum