Changeset 3481:22f4d04a1114 in roaraudio for libroarpulse


Ignore:
Timestamp:
02/14/10 05:42:34 (10 years ago)
Author:
phi
Branch:
default
Message:

restarted poll() in case we got interuppted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroarpulse/mainloop.c

    r3472 r3481  
    167167 int i; 
    168168 
     169 ROAR_DBG("pa_mainloop_prepare(m=%p, timeout=%i) = ?", m, timeout); 
     170 
    169171 if ( m == NULL ) 
    170172  return -1; 
     
    202204 m->poll_timeout = timeout; 
    203205 
     206 ROAR_DBG("pa_mainloop_prepare(m=%p, timeout=%i) = 0", m, timeout); 
    204207 return 0; 
    205208} 
     
    208211int pa_mainloop_poll(pa_mainloop *m) { 
    209212 int ret; 
     213 int alive = 1; 
     214 
     215 ROAR_DBG("pa_mainloop_poll(m=%p) = ?", m); 
    210216 
    211217 if ( m == NULL ) 
     
    215221  return -2; 
    216222 
    217  if ( m->poll_func != NULL ) { 
    218   ret = m->poll_func(m->pollfd, m->pollfds, m->poll_timeout, m->poll_userdata); 
    219  } else { 
    220   ret = poll(m->pollfd, m->pollfds, m->poll_timeout); 
    221  } 
    222  
     223 while (alive) { 
     224  if ( m->poll_func != NULL ) { 
     225   ret = m->poll_func(m->pollfd, m->pollfds, m->poll_timeout, m->poll_userdata); 
     226  } else { 
     227   ret = poll(m->pollfd, m->pollfds, m->poll_timeout); 
     228  } 
     229 
     230  if ( ret != -1 || ( errno != EAGAIN && errno != EINTR ) ) { 
     231   alive = 0; 
     232  } 
     233 } 
     234 
     235 ROAR_DBG("pa_mainloop_poll(m=%p) = %i", m, ret); 
    223236 return ret; 
    224237} 
     
    229242 pa_io_event_flags_t events; 
    230243 int count = 0; 
    231  
    232244 int i, h; 
     245 
     246 ROAR_DBG("pa_mainloop_dispatch(m=%p) = ?", m); 
    233247 
    234248 if ( m == NULL ) 
     
    265279 } 
    266280 
     281 ROAR_DBG("pa_mainloop_dispatch(m=%p) = %i", m, count); 
    267282 return count; 
    268283} 
Note: See TracChangeset for help on using the changeset viewer.