* Copyright © 2006 Pierre Habouzit
*/
+#include <pthread.h>
#include <sys/epoll.h>
#include <sys/socket.h>
#ifndef EPOLLRDHUP
int event = events[count].events;
int evt = 0;
+ gettimeofday(&w->mru, NULL);
switch (w->state) {
case EL_LLP_INIT:
w->llp(w);
return 0;
}
+void *el_loop(void *data)
+{
+ time_t sec = time(NULL);
+
+ for (;;) {
+ struct timeval now;
+
+ el_dispatch(100);
+ pthread_testcancel();
+
+ gettimeofday(&now, NULL);
+ if (sec >= now.tv_sec)
+ continue;
+ sec = now.tv_sec;
+ now.tv_sec -= 10;
+ for (int i = jobs.len - 1; i >= 0; --i) {
+ job_t *w = jobs.arr[i];
+ if (timercmp(&now, &w->mru, >))
+ IGNORE(w->m->on_event(w, EL_EVT_WAKEUP));
+ }
+ }
+}
+
void el_initialize(void)
{
gnutls_global_init();
el_mode mode : 3;
el_mode emode : 3;
+ struct timeval mru;
int (*llp)(struct job_t *);
const struct machine_t *m;
void *ptr;
int el_dispatch(int timeout);
+void *el_loop(void *);
+
void el_initialize(void);
void el_shutdown(void);
fputc('\n', stderr);
}
-static void *evtloop(void *data)
-{
- for (;;) {
- el_dispatch(100);
- pthread_testcancel();
- }
-}
-
int main (int argc, char **argv)
{
char folder[_POSIX_PATH_MAX] = "";
el_initialize();
mutt_init (flags & M_NOSYSRC, commands);
string_list_wipe(&commands);
- pthread_create(&pt, NULL, &evtloop, NULL);
+ pthread_create(&pt, NULL, &el_loop, NULL);
if (!option(OPTNOCURSES)) {
ui_layout_init();