Changeset 15e54f5 in mainline


Ignore:
Timestamp:
2011-06-09T15:11:30Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e6211f8
Parents:
4a4c8bcf
Message:

fix deadlock in client part of devman protocol

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/devman.c

    r4a4c8bcf r15e54f5  
    231231        }
    232232       
    233         async_wait_for(req, &retval);
    234         if (retval != EOK) {
    235                 devman_exchange_end(exch);
    236                
    237                 if (funh != NULL)
    238                         *funh = -1;
    239                
    240                 return retval;
    241         }
    242        
    243         if (funh != NULL)
    244                 *funh = (int) IPC_GET_ARG1(answer);
    245        
    246233        link_t *link = match_ids->ids.next;
    247234        match_id_t *match_id = NULL;
     
    250237                match_id = list_get_instance(link, match_id_t, link);
    251238               
    252                 ipc_call_t answer;
    253                 aid_t req = async_send_1(exch, DEVMAN_ADD_MATCH_ID,
    254                     match_id->score, &answer);
     239                ipc_call_t answer2;
     240                aid_t req2 = async_send_1(exch, DEVMAN_ADD_MATCH_ID,
     241                    match_id->score, &answer2);
    255242                retval = async_data_write_start(exch, match_id->id,
    256243                    str_size(match_id->id));
     244                if (retval != EOK) {
     245                        devman_exchange_end(exch);
     246                        async_wait_for(req2, NULL);
     247                        async_wait_for(req, NULL);
     248                        return retval;
     249                }
     250               
     251                async_wait_for(req2, &retval);
    257252                if (retval != EOK) {
    258253                        devman_exchange_end(exch);
     
    261256                }
    262257               
    263                 async_wait_for(req, &retval);
    264                 if (retval != EOK) {
    265                         devman_exchange_end(exch);
    266                         return retval;
    267                 }
    268                
    269258                link = link->next;
    270259        }
    271260       
    272261        devman_exchange_end(exch);
    273         return EOK;
     262       
     263        async_wait_for(req, &retval);
     264        if (retval != EOK) {
     265                if (funh != NULL)
     266                        *funh = (int) IPC_GET_ARG1(answer);
     267        } else {
     268                if (funh != NULL)
     269                        *funh = -1;
     270        }
     271       
     272        return retval;
    274273}
    275274
Note: See TracChangeset for help on using the changeset viewer.