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

Comparing libev/ev_kqueue.c (file contents):
Revision 1.36 by root, Thu Jul 9 09:11:20 2009 UTC vs.
Revision 1.40 by root, Sun Jul 19 04:11:27 2009 UTC

1/* 1/*
2 * libev kqueue backend 2 * libev kqueue backend
3 * 3 *
4 * Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de> 4 * Copyright (c) 2007,2008,2009 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 *
91 ev_free (kqueue_events); 91 ev_free (kqueue_events);
92 kqueue_eventmax = array_nextsize (sizeof (struct kevent), kqueue_eventmax, kqueue_changecnt); 92 kqueue_eventmax = array_nextsize (sizeof (struct kevent), kqueue_eventmax, kqueue_changecnt);
93 kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax); 93 kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax);
94 } 94 }
95 95
96 if (expect_false (suspend_cb)) suspend_cb (EV_A); 96 EV_RELEASE_CB;
97 ts.tv_sec = (time_t)timeout; 97 ts.tv_sec = (time_t)timeout;
98 ts.tv_nsec = (long)((timeout - (ev_tstamp)ts.tv_sec) * 1e9); 98 ts.tv_nsec = (long)((timeout - (ev_tstamp)ts.tv_sec) * 1e9);
99 res = kevent (backend_fd, kqueue_changes, kqueue_changecnt, kqueue_events, kqueue_eventmax, &ts); 99 res = kevent (backend_fd, kqueue_changes, kqueue_changecnt, kqueue_events, kqueue_eventmax, &ts);
100 if (expect_false (resume_cb)) resume_cb (EV_A); 100 EV_ACQUIRE_CB;
101 kqueue_changecnt = 0; 101 kqueue_changecnt = 0;
102 102
103 if (expect_false (res < 0)) 103 if (expect_false (res < 0))
104 { 104 {
105 if (errno != EINTR) 105 if (errno != EINTR)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines