ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.h
(Generate patch)

Comparing libev/ev.h (file contents):
Revision 1.181 by root, Mon Jan 19 16:45:19 2015 UTC vs.
Revision 1.182 by root, Tue Apr 21 10:10:57 2015 UTC

1/* 1/*
2 * libev native API header 2 * libev native API header
3 * 3 *
4 * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann <libev@schmorp.de> 4 * Copyright (c) 2007,2008,2009,2010,2011,2012,2015 Marc Alexander Lehmann <libev@schmorp.de>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without modifica- 7 * Redistribution and use in source and binary forms, with or without modifica-
8 * tion, are permitted provided that the following conditions are met: 8 * tion, are permitted provided that the following conditions are met:
9 * 9 *
150 150
151/*****************************************************************************/ 151/*****************************************************************************/
152 152
153typedef double ev_tstamp; 153typedef double ev_tstamp;
154 154
155#include <string.h> /* for memmove */
156
155#ifndef EV_ATOMIC_T 157#ifndef EV_ATOMIC_T
156# include <signal.h> 158# include <signal.h>
157# define EV_ATOMIC_T sig_atomic_t volatile 159# define EV_ATOMIC_T sig_atomic_t volatile
158#endif 160#endif
159 161
717#define ev_async_init(ev,cb) do { ev_init ((ev), (cb)); ev_async_set ((ev)); } while (0) 719#define ev_async_init(ev,cb) do { ev_init ((ev), (cb)); ev_async_set ((ev)); } while (0)
718 720
719#define ev_is_pending(ev) (0 + ((ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */ 721#define ev_is_pending(ev) (0 + ((ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */
720#define ev_is_active(ev) (0 + ((ev_watcher *)(void *)(ev))->active) /* ro, true when the watcher has been started */ 722#define ev_is_active(ev) (0 + ((ev_watcher *)(void *)(ev))->active) /* ro, true when the watcher has been started */
721 723
722#define ev_cb(ev) (ev)->cb /* rw */ 724#define ev_cb_(ev) (ev)->cb /* rw */
725#define ev_cb(ev) (memmove (&ev_cb_ (ev), &((ev_watcher *)(ev))->cb, sizeof (ev_cb_ (ev))), (ev)->cb)
723 726
724#if EV_MINPRI == EV_MAXPRI 727#if EV_MINPRI == EV_MAXPRI
725# define ev_priority(ev) ((ev), EV_MINPRI) 728# define ev_priority(ev) ((ev), EV_MINPRI)
726# define ev_set_priority(ev,pri) ((ev), (pri)) 729# define ev_set_priority(ev,pri) ((ev), (pri))
727#else 730#else
730#endif 733#endif
731 734
732#define ev_periodic_at(ev) (+((ev_watcher_time *)(ev))->at) 735#define ev_periodic_at(ev) (+((ev_watcher_time *)(ev))->at)
733 736
734#ifndef ev_set_cb 737#ifndef ev_set_cb
735# define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_) 738# define ev_set_cb(ev,cb_) (ev_cb_ (ev) = (cb_), memmove (&((ev_watcher *)(ev))->cb, &ev_cb_ (ev), sizeof (ev_cb_ (ev))))
736#endif 739#endif
737 740
738/* stopping (enabling, adding) a watcher does nothing if it is already running */ 741/* stopping (enabling, adding) a watcher does nothing if it is already running */
739/* stopping (disabling, deleting) a watcher does nothing unless it's already running */ 742/* stopping (disabling, deleting) a watcher does nothing unless it's already running */
740#if EV_PROTOTYPES 743#if EV_PROTOTYPES

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines