Changeset b233821 in mainline


Ignore:
Timestamp:
2018-01-12T11:38:04Z (6 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fcdab1e
Parents:
0b90f49
Message:

usbhub: join without defuncting the DDF node

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/usbhub.c

    r0b90f49 rb233821  
    263263        usb_log_info("(%p) USB hub gone, joining polling fibril.", hub);
    264264
    265         // TODO: Join the polling fibril in a better way?
    266         unsigned tries = 10;
    267         while (hub->running) {
    268                 async_usleep(100000);
    269                 if (!tries--) {
    270                         usb_log_error("(%p): Can't remove hub, still running.",
    271                             hub);
    272                         return EBUSY;
    273                 }
    274         }
    275 
     265        /* Join polling fibril. */
     266        fibril_mutex_lock(&hub->poll_guard);
     267        while (hub->running)
     268                fibril_condvar_wait(&hub->poll_cv, &hub->poll_guard);
     269        fibril_mutex_unlock(&hub->poll_guard);
     270
     271        /* Destroy hub. */
    276272        return usb_hub_cleanup(hub);
    277273}
Note: See TracChangeset for help on using the changeset viewer.