void LBNotifConnection::loop() { edg_wll_JobStat stat; char *et, *ed; struct timeval timeout = { 30, 0 }; bool run = true; while ( run ) { int res = edg_wll_NotifReceive( _ctx, -1, &timeout, &stat, NULL ); switch ( res ) { case 0: /* OK, got it */ processEvent( stat ); edg_wll_FreeStatus( &stat ); break; case ETIMEDOUT: case EAGAIN: /* timeout */ if ( edg_wll_NotifRefresh( _ctx, _notif, &_valid ) ) { edg_wll_Error( _ctx, &et, &ed ); fprintf( stderr, "edg_wll_NotifRefresh(): %s (%s)\n", et, ed ); exit( 2 ); } printf( "Notification refreshed, expires %s", ctime( &_valid ) ); break; default: edg_wll_Error( _ctx, &et, &ed ); fprintf( stderr,"edg_wll_NotifReceive() returned %d: %s (%s)\n", res, et, ed ); exit( 2 ); break; } } }