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

Comparing libev/ev.c (file contents):
Revision 1.420 by root, Wed Apr 18 05:44:42 2012 UTC vs.
Revision 1.424 by root, Tue May 1 22:01:40 2012 UTC

359#endif 359#endif
360 360
361/* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */ 361/* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */
362/* which makes programs even slower. might work on other unices, too. */ 362/* which makes programs even slower. might work on other unices, too. */
363#if EV_USE_CLOCK_SYSCALL 363#if EV_USE_CLOCK_SYSCALL
364# include <syscall.h> 364# include <sys/syscall.h>
365# ifdef SYS_clock_gettime 365# ifdef SYS_clock_gettime
366# define clock_gettime(id, ts) syscall (SYS_clock_gettime, (id), (ts)) 366# define clock_gettime(id, ts) syscall (SYS_clock_gettime, (id), (ts))
367# undef EV_USE_MONOTONIC 367# undef EV_USE_MONOTONIC
368# define EV_USE_MONOTONIC 1 368# define EV_USE_MONOTONIC 1
369# else 369# else
1844} 1844}
1845 1845
1846inline_speed void 1846inline_speed void
1847evpipe_write (EV_P_ EV_ATOMIC_T *flag) 1847evpipe_write (EV_P_ EV_ATOMIC_T *flag)
1848{ 1848{
1849 ECB_MEMORY_FENCE; /* push out the write before this function was called, acquire flag */
1850
1849 if (expect_true (*flag)) 1851 if (expect_true (*flag))
1850 return; 1852 return;
1851 1853
1852 *flag = 1; 1854 *flag = 1;
1853 1855
1912 } 1914 }
1913 } 1915 }
1914 1916
1915 pipe_write_skipped = 0; 1917 pipe_write_skipped = 0;
1916 1918
1919 ECB_MEMORY_FENCE; /* push out skipped, acquire flags */
1920
1917#if EV_SIGNAL_ENABLE 1921#if EV_SIGNAL_ENABLE
1918 if (sig_pending) 1922 if (sig_pending)
1919 { 1923 {
1920 sig_pending = 0; 1924 sig_pending = 0;
1925
1926 ECB_MEMORY_FENCE_RELEASE;
1921 1927
1922 for (i = EV_NSIG - 1; i--; ) 1928 for (i = EV_NSIG - 1; i--; )
1923 if (expect_false (signals [i].pending)) 1929 if (expect_false (signals [i].pending))
1924 ev_feed_signal_event (EV_A_ i + 1); 1930 ev_feed_signal_event (EV_A_ i + 1);
1925 } 1931 }
1927 1933
1928#if EV_ASYNC_ENABLE 1934#if EV_ASYNC_ENABLE
1929 if (async_pending) 1935 if (async_pending)
1930 { 1936 {
1931 async_pending = 0; 1937 async_pending = 0;
1938
1939 ECB_MEMORY_FENCE_RELEASE;
1932 1940
1933 for (i = asynccnt; i--; ) 1941 for (i = asynccnt; i--; )
1934 if (asyncs [i]->sent) 1942 if (asyncs [i]->sent)
1935 { 1943 {
1936 asyncs [i]->sent = 0; 1944 asyncs [i]->sent = 0;
2215{ 2223{
2216 invoke_cb = invoke_pending_cb; 2224 invoke_cb = invoke_pending_cb;
2217} 2225}
2218 2226
2219void 2227void
2220ev_set_loop_release_cb (EV_P_ void (*release)(EV_P), void (*acquire)(EV_P)) EV_THROW 2228ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_THROW, void (*acquire)(EV_P) EV_THROW) EV_THROW
2221{ 2229{
2222 release_cb = release; 2230 release_cb = release;
2223 acquire_cb = acquire; 2231 acquire_cb = acquire;
2224} 2232}
2225#endif 2233#endif
2319 } 2327 }
2320} 2328}
2321 2329
2322/* free up a loop structure */ 2330/* free up a loop structure */
2323void ecb_cold 2331void ecb_cold
2324ev_loop_destroy (EV_P) EV_THROW 2332ev_loop_destroy (EV_P)
2325{ 2333{
2326 int i; 2334 int i;
2327 2335
2328#if EV_MULTIPLICITY 2336#if EV_MULTIPLICITY
2329 /* mimic free (0) */ 2337 /* mimic free (0) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines