Changeset 12e291a


Ignore:
Timestamp:
Oct 19, 2009, 10:16:54 PM (12 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
0697f09
Parents:
dbf94e9
git-author:
Alejandro R. Sedeño <asedeno@mit.edu> (10/13/09 03:14:02)
git-committer:
Alejandro R. Sedeño <asedeno@mit.edu> (10/19/09 22:16:54)
Message:
Add a zephyr pre-select action.

This replaces the solution commited in
5657d536d09861fe734329e12194b4c410d34d20.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zephyr.c

    rcc1a6d4 r12e291a  
    135135  }
    136136
    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);
    139141}
    140142
     
    13051307}
    13061308
    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
     1318int _owl_zephyr_process_events(void) /* noproto */
     1319{
    13091320  int zpendcount=0;
     1321#ifdef HAVE_LIBZEPHYR
    13101322  ZNotice_t notice;
    13111323  owl_message *m=NULL;
    13121324
    1313   while(owl_zephyr_zpending() && zpendcount < 20) {
     1325  while(owl_zephyr_zpending() && zpendcount < OWL_MAX_ZEPHYRGRAMS_TO_PROCESS) {
    13141326    if (owl_zephyr_zpending()) {
    13151327      ZReceiveNotice(&notice, NULL);
     
    13341346    }
    13351347  }
    1336 }
    1337 
    1338 #else
    1339 void owl_zephyr_process_events(owl_dispatch *d) {
    1340  
    1341 }
    1342 #endif
     1348#endif
     1349  return zpendcount;
     1350}
     1351
     1352void owl_zephyr_process_events(owl_dispatch *d)
     1353{
     1354  _owl_zephyr_process_events();
     1355}
     1356
     1357int owl_zephyr_pre_select_action(owl_ps_action *a, void *p)
     1358{
     1359  return _owl_zephyr_process_events();
     1360}
Note: See TracChangeset for help on using the changeset viewer.