Changeset 38648f0 in mainline


Ignore:
Timestamp:
2011-02-04T12:43:27Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3d31af5
Parents:
9f5667a
Message:

Synchronization in device recognition routines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/recognise.c

    r9f5667a r38648f0  
    359359{
    360360        static size_t device_name_index = 0;
     361        static FIBRIL_MUTEX_INITIALIZE(device_name_index_mutex);
     362
     363        size_t this_device_name_index;
     364
     365        fibril_mutex_lock(&device_name_index_mutex);
     366        this_device_name_index = device_name_index;
     367        device_name_index++;
     368        fibril_mutex_unlock(&device_name_index_mutex);
     369
    361370
    362371        device_t *child = NULL;
     
    374383         * naming etc., something more descriptive could be created.
    375384         */
    376         rc = asprintf(&child_name, "usbdev%02zu", device_name_index);
     385        rc = asprintf(&child_name, "usbdev%02zu", this_device_name_index);
    377386        if (rc < 0) {
    378387                goto failure;
     
    396405        }
    397406       
    398         device_name_index++;
    399 
    400407        return EOK;
    401408
Note: See TracChangeset for help on using the changeset viewer.