~ubuntu-branches/ubuntu/natty/transmission/natty

« back to all changes in this revision

Viewing changes to third-party/libevent/event.c

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Klimonda
  • Date: 2009-12-08 10:49:11 UTC
  • mfrom: (1.1.29 upstream) (2.1.10 sid)
  • Revision ID: james.westby@ubuntu.com-20091208104911-06gio45n2nla3vpg
Tags: 1.80~b1-0ubuntu1
* New upstream release (LP: #460620), rebased on debian unstable
  remaining changes:
  - debian/control:
    + Added replaces & provides clutch (now included as part of transmission).
      Can be removed in lucid+1
    + Added quilt, liblaunchpad-integration-dev and lsb-release to Build-Depends
  - debian/rules:
    + create a po template during package build.
  - debian/patches/01_lpi.patch:
    + integrate transmission with launchpad
  - debian/patches/20_add_x-ubuntu-gettext-domain.diff:
    + add x-ubuntu-gettext-domain to .desktop file.
  - debian/transmission-daemon.default:
    - remove --auth from OPTIONS
* Fixes bugs:
  - tray menu shows wrong status for "main window" when started minimized
    (LP: #451415)
* Refreshed patches:
  - dont_build_libevent.patch
  - 99_autoreconf.patch
* Removed patches:
  - 21_onPortTested.diff, 23_tr_torrentNext.diff and
    24_tr_torrentDeleteLocalData_do_move.diff
* debian/patches/21_fix_inhibition.patch:
  - The right value for suspend inhibition is 4
* debian/control:
  - Build-Depend on libgconf2-dev to enable magnet link registration and on
    libcanberra-gtk-dev for notification sound.
* debian/watch:
  - make it detect beta versions, to be removed after 1.80 is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#ifdef HAVE_SYS_TIME_H
38
38
#include <sys/time.h>
39
39
#else 
40
 
#include <sys/_time.h>
 
40
#include <sys/_libevent_time.h>
41
41
#endif
42
42
#include <sys/queue.h>
43
43
#include <stdio.h>
109
109
extern struct event_base *evsignal_base;
110
110
static int use_monotonic;
111
111
 
112
 
/* Handle signals - This is a deprecated interface */
113
 
int (*event_sigcb)(void);               /* Signal callback when gotsig is set */
114
 
volatile sig_atomic_t event_gotsig;     /* Set in signal handler */
115
 
 
116
112
/* Prototypes */
117
113
static void     event_queue_insert(struct event_base *, struct event *, int);
118
114
static void     event_queue_remove(struct event_base *, struct event *, int);
179
175
        if ((base = calloc(1, sizeof(struct event_base))) == NULL)
180
176
                event_err(1, "%s: calloc", __func__);
181
177
 
182
 
        event_sigcb = NULL;
183
 
        event_gotsig = 0;
184
 
 
185
178
        detect_monotonic();
186
179
        gettime(base, &base->event_tv);
187
180
        
200
193
        if (base->evbase == NULL)
201
194
                event_errx(1, "%s: no event mechanism available", __func__);
202
195
 
203
 
        if (getenv("EVENT_SHOW_METHOD")) 
 
196
        if (evutil_getenv("EVENT_SHOW_METHOD")) 
204
197
                event_msgx("libevent using: %s\n",
205
198
                           base->evsel->name);
206
199
 
333
326
 
334
327
        /* Allocate our priority queues */
335
328
        base->nactivequeues = npriorities;
336
 
        base->activequeues = (struct event_list **)calloc(base->nactivequeues,
337
 
            npriorities * sizeof(struct event_list *));
 
329
        base->activequeues = (struct event_list **)
 
330
            calloc(base->nactivequeues, sizeof(struct event_list *));
338
331
        if (base->activequeues == NULL)
339
332
                event_err(1, "%s: calloc", __func__);
340
333
 
390
383
                        ncalls--;
391
384
                        ev->ev_ncalls = ncalls;
392
385
                        (*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_arg);
393
 
                        if (event_gotsig || base->event_break)
 
386
                        if (base->event_break)
394
387
                                return;
395
388
                }
396
389
        }
495
488
                        break;
496
489
                }
497
490
 
498
 
                /* You cannot use this interface for multi-threaded apps */
499
 
                while (event_gotsig) {
500
 
                        event_gotsig = 0;
501
 
                        if (event_sigcb) {
502
 
                                res = (*event_sigcb)();
503
 
                                if (res == -1) {
504
 
                                        errno = EINTR;
505
 
                                        return (-1);
506
 
                                }
507
 
                        }
508
 
                }
509
 
 
510
491
                timeout_correct(base, &tv);
511
492
 
512
493
                tv_p = &tv;