Changeset 15688


Ignore:
Timestamp:
05/12/12 11:45:49 (11 years ago)
Author:
nit
Message:

[titan] fix dead lock

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/channel.h

    r15143 r15688  
    3636}
    3737
    38 struct channel* getlastchannel(struct channel* node)
     38//flag 0: lock
     39//flag 1: no lock
     40struct channel* getlastchannel(struct channel* node, int flag)
    3941{
    4042        debug(1000, "in");
    4143        struct channel *prev = NULL;
    4244
    43         m_lock(&status.channelmutex, 5);
     45        if(flag == 0) m_lock(&status.channelmutex, 5);
    4446        while(node != NULL)
    4547        {
     
    4749                node = node->next;
    4850        }
    49         m_unlock(&status.channelmutex, 5);
     51        if(flag == 0) m_unlock(&status.channelmutex, 5);
    5052
    5153        debug(1000, "out");
     
    136138        if(node->prev == NULL)
    137139        {
    138                 last = getlastchannel(channel);
     140                last = getlastchannel(channel, 1);
    139141
    140142                if(node->next != NULL)
Note: See TracChangeset for help on using the changeset viewer.