Changeset 12e291a330f117a61b8b222315c1f39822010a2a
- Timestamp:
- 10/19/09 22:16:54 (5 weeks ago)
- Author:
- Alejandro R. Sedeño <asedeno@mit.edu>
- git-author:
- Alejandro R. Sedeño <asedeno@mit.edu> / 2009-10-13T03:14:02Z-0400
- Parents:
- dbf94e9d63a677506783cbdb11f0d965aa5f1d70
- Children:
- 0697f097cd4d945d2e96f60d1690da9c5f4d9dc4
- git-committer:
- Alejandro R. Sedeño <asedeno@mit.edu> / 2009-10-19T22:16:54Z-0400
- Message:
-
Add a zephyr pre-select action.
This replaces the solution commited in
5657d536d09861fe734329e12194b4c410d34d20.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rcc1a6d4
|
r12e291a
|
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | | perl = owl_perlconfig_execute("BarnOwl::Zephyr::_zephyr_startup()"); |
| 138 | | owl_free(perl); |
| | 137 | perl = owl_perlconfig_execute("BarnOwl::Zephyr::_zephyr_startup()"); |
| | 138 | owl_free(perl); |
| | 139 | |
| | 140 | owl_select_add_pre_select_action(owl_zephyr_pre_select_action, NULL, NULL); |
| 139 | 141 | } |
| 140 | 142 | |
| … |
… |
|
| 1305 | 1307 | } |
| 1306 | 1308 | |
| 1307 | | #ifdef HAVE_LIBZEPHYR |
| 1308 | | void owl_zephyr_process_events(owl_dispatch *d) { |
| | 1309 | /* |
| | 1310 | * Process zephyrgrams from libzephyr's queue. To prevent starvation, |
| | 1311 | * process a maximum of OWL_MAX_ZEPHYRGRAMS_TO_PROCESS. |
| | 1312 | * |
| | 1313 | * Returns the number of zephyrgrams processed. |
| | 1314 | */ |
| | 1315 | |
| | 1316 | #define OWL_MAX_ZEPHYRGRAMS_TO_PROCESS 20 |
| | 1317 | |
| | 1318 | int _owl_zephyr_process_events(void) /* noproto */ |
| | 1319 | { |
| 1309 | 1320 | int zpendcount=0; |
| | 1321 | #ifdef HAVE_LIBZEPHYR |
| 1310 | 1322 | ZNotice_t notice; |
| 1311 | 1323 | owl_message *m=NULL; |
| 1312 | 1324 | |
| 1313 | | while(owl_zephyr_zpending() && zpendcount < 20) { |
| | 1325 | while(owl_zephyr_zpending() && zpendcount < OWL_MAX_ZEPHYRGRAMS_TO_PROCESS) { |
| 1314 | 1326 | if (owl_zephyr_zpending()) { |
| 1315 | 1327 | ZReceiveNotice(¬ice, NULL); |
| … |
… |
|
| 1334 | 1346 | } |
| 1335 | 1347 | } |
| 1336 | | } |
| 1337 | | |
| 1338 | | #else |
| 1339 | | void owl_zephyr_process_events(owl_dispatch *d) { |
| 1340 | | |
| 1341 | | } |
| 1342 | | #endif |
| | 1348 | #endif |
| | 1349 | return zpendcount; |
| | 1350 | } |
| | 1351 | |
| | 1352 | void owl_zephyr_process_events(owl_dispatch *d) |
| | 1353 | { |
| | 1354 | _owl_zephyr_process_events(); |
| | 1355 | } |
| | 1356 | |
| | 1357 | int owl_zephyr_pre_select_action(owl_ps_action *a, void *p) |
| | 1358 | { |
| | 1359 | return _owl_zephyr_process_events(); |
| | 1360 | } |