Changeset 12e291a330f117a61b8b222315c1f39822010a2a

Show
Ignore:
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:
1 modified

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}