1 | /* |
1 | /* |
2 | iom.C -- generic I/O multiplexer |
2 | iom.C -- generic I/O multiplexer |
3 | Copyright (C) 2003, 2004 Marc Lehmann <gvpe@schmorp.de> |
3 | Copyright (C) 2003-2006 Marc Lehmann <gvpe@schmorp.de> |
4 | |
4 | |
5 | This file is part of GVPE. |
5 | This file is part of GVPE. |
6 | |
6 | |
7 | GVPE is free software; you can redistribute it and/or modify |
7 | GVPE is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by |
8 | it under the terms of the GNU General Public License as published by |
… | |
… | |
116 | |
116 | |
117 | if (!w) |
117 | if (!w) |
118 | pw.erase_unordered (i); |
118 | pw.erase_unordered (i); |
119 | else if (w->pid == pid) |
119 | else if (w->pid == pid) |
120 | { |
120 | { |
121 | w->stop (); |
121 | io_manager::unreg (*w); |
122 | w->call (*w, status); |
122 | w->call (*w, status); |
123 | } |
123 | } |
124 | } |
124 | } |
125 | |
|
|
126 | } |
125 | } |
127 | |
126 | |
128 | sw0 () |
127 | sw0 () |
129 | : sig_watcher (this, &sw0::cb) |
128 | : sig_watcher (this, &sw0::cb) |
130 | { } |
129 | { } |
… | |
… | |
150 | |
149 | |
151 | // used for initialisation only |
150 | // used for initialisation only |
152 | static struct init { |
151 | static struct init { |
153 | init () |
152 | init () |
154 | { |
153 | { |
|
|
154 | #ifdef IOM_PREINIT |
|
|
155 | { IOM_PREINIT } |
|
|
156 | #endif |
155 | iom_valid = true; |
157 | iom_valid = true; |
156 | |
158 | |
157 | #if IOM_SIG |
159 | #if IOM_SIG |
158 | sigemptyset (&sigs); |
160 | sigemptyset (&sigs); |
159 | |
161 | |
… | |
… | |
173 | |
175 | |
174 | #if IOM_TIME |
176 | #if IOM_TIME |
175 | io_manager::set_now (); |
177 | io_manager::set_now (); |
176 | |
178 | |
177 | tw0.start (TSTAMP_MAX); |
179 | tw0.start (TSTAMP_MAX); |
|
|
180 | #endif |
|
|
181 | |
|
|
182 | #ifdef IOM_POSTINIT |
|
|
183 | { IOM_POSTINIT } |
178 | #endif |
184 | #endif |
179 | } |
185 | } |
180 | |
186 | |
181 | ~init () |
187 | ~init () |
182 | { |
188 | { |