Changeset 10a5479d in mainline


Ignore:
Timestamp:
2012-01-22T14:18:38Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update
Children:
49ec568, fcae007
Parents:
eb2efc7
Message:

Prevent callbacks from racing. This was probably the culprit which was
causing sometimes the mouse, sometimes the network adapter not to be
discovered.

Location:
uspace/srv
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/input/generic/input.c

    reb2efc7 r10a5479d  
    3939#include <adt/list.h>
    4040#include <bool.h>
     41#include <fibril_synch.h>
    4142#include <ipc/services.h>
    4243#include <ipc/input.h>
     
    8384async_sess_t *irc_sess = NULL;
    8485
     86static FIBRIL_MUTEX_INITIALIZE(discovery_lock);
     87
    8588void kbd_push_data(kbd_dev_t *kdev, sysarg_t data)
    8689{
     
    593596        int rc;
    594597       
     598        fibril_mutex_lock(&discovery_lock);
     599       
    595600        rc = dev_check_new_kbdevs();
    596         if (rc != EOK)
     601        if (rc != EOK) {
     602                fibril_mutex_unlock(&discovery_lock);
    597603                return rc;
     604        }
    598605       
    599606        rc = dev_check_new_mousedevs();
    600         if (rc != EOK)
     607        if (rc != EOK) {
     608                fibril_mutex_unlock(&discovery_lock);
    601609                return rc;
    602 
     610        }
     611       
     612        fibril_mutex_unlock(&discovery_lock);
     613       
    603614        return EOK;
    604615}
  • uspace/srv/net/net/net.c

    reb2efc7 r10a5479d  
    5656#include <adt/measured_strings.h>
    5757#include <adt/module_map.h>
     58#include <fibril_synch.h>
    5859#include <loc.h>
    5960#include <nic.h>
     
    7677DEVICE_MAP_IMPLEMENT(netifs, netif_t);
    7778LIST_INITIALIZE(netif_list);
     79
     80static FIBRIL_MUTEX_INITIALIZE(discovery_lock);
    7881
    7982/** Add the configured setting to the configuration map.
     
    294297        printf("%s: Initializing device '%s'\n", NAME, netif->name);
    295298       
    296         link_initialize(&netif->netif_list);
    297        
    298299        netif->sid = sid;
    299300        netif->sess = loc_service_connect(EXCHANGE_SERIALIZE, netif->sid,
     
    535536        int rc;
    536537
     538        fibril_mutex_lock(&discovery_lock);
     539
    537540        rc = loc_category_get_id(DEVICE_CATEGORY_NIC, &nic_cat, IPC_FLAG_BLOCKING);
    538541        if (rc != EOK) {
     
    569572
    570573        free(svcs);
     574        fibril_mutex_unlock(&discovery_lock);
    571575        return EOK;
    572576}
Note: See TracChangeset for help on using the changeset viewer.