ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/evthread.C
(Generate patch)

Comparing deliantra/server/server/evthread.C (file contents):
Revision 1.4 by root, Sun Apr 6 16:13:23 2008 UTC vs.
Revision 1.10 by root, Tue Nov 3 23:44:21 2009 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2008,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * 5 *
6 * Deliantra is free software: you can redistribute it and/or modify 6 * Deliantra is free software: you can redistribute it and/or modify it under
7 * it under the terms of the GNU General Public License as published by 7 * the terms of the Affero GNU General Public License as published by the
8 * the Free Software Foundation, either version 3 of the License, or 8 * Free Software Foundation, either version 3 of the License, or (at your
9 * (at your option) any later version. 9 * option) any later version.
10 * 10 *
11 * This program is distributed in the hope that it will be useful, 11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the Affero GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * and the GNU General Public License along with this program. If not, see
18 * <http://www.gnu.org/licenses/>.
18 * 19 *
19 * The authors can be reached via e-mail to <support@deliantra.net> 20 * The authors can be reached via e-mail to <support@deliantra.net>
20 */ 21 */
21 22
22#include "global.h" 23#include "global.h"
83static EV_ATOMIC_T aio_pending; 84static EV_ATOMIC_T aio_pending;
84 85
85static void 86static void
86aio2_cb (EV_P_ ev_idle *w, int revents) 87aio2_cb (EV_P_ ev_idle *w, int revents)
87{ 88{
89 IV reqs;
90
88 CALL_BEGIN (0); 91 CALL_BEGIN (0);
89 CALL_CALL ("IO::AIO::poll_cb", G_SCALAR); 92 CALL_CALL ("IO::AIO::poll_cb", G_SCALAR);
90 93
94 reqs = POPi;
91 if (count > 0 && TOPi > 0) 95 if (count > 0 && reqs < 0)
92 ev_idle_start (EV_A, w); 96 ev_idle_start (EV_A, w);
93 else 97 else
94 ev_idle_stop (EV_A, w); 98 ev_idle_stop (EV_A, w);
95 99
96 CALL_END; 100 CALL_END;
103} 107}
104 108
105static void 109static void
106aio1_cb (EV_P_ ev_io *w, int revents) 110aio1_cb (EV_P_ ev_io *w, int revents)
107{ 111{
108 char dummy; 112 char dummy[9];
109 113
110 if (read (w->fd, &dummy, 1) > 0) 114 if (read (w->fd, dummy, sizeof (dummy)) > 0)
111 { 115 {
112 ev_async_send (EV_DEFAULT_UC, &async_watcher); 116 ev_async_send (EV_DEFAULT_UC, &async_watcher);
113 coroapi::cede_pending = 1; 117 coroapi::cede_pending = 1;
114 } 118 }
115} 119}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines