Changeset 472


Ignore:
Timestamp:
05/31/11 12:52:07 (13 years ago)
Author:
mmaipsl
Message:

Create new function IGCM_card_CheckConflict in place of Mutex Algorithm to lock edited cards.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_card/libIGCM_card.ksh

    r373 r472  
    195195        tmpfile=$1_mutex_$$ 
    196196 
    197         # Watch for possible conflics : Check for other tmpfiles. 
    198         unset tmpfiles 
    199         set +A tmpfiles -- $( ls $1_mutex_[0-9]* 2>/dev/null ) 
    200         typeset isleep 
    201         ((isleep=0)) 
    202         while [ ${#tmpfiles[@]} -gt 0 ] ; do  
    203             echo "Conflict between two processes working on " $1 "!!!" ${tmpfiles[@]} 
    204             sleep 1 
    205             ((isleep=isleep+1)) 
    206             if [ isleep -gt 20 ] ; then 
    207                 echo "Too many loops waiting for other process working on " $1 ". We continue." 
    208                 echo "You should see if one process of your run or post-treatment may have terminated suddenly." 
    209                 echo "Afer, you should erase this(those) file(s) : " ${tmpfiles[@]} 
    210 # Send a mail to USER ?? 
    211                 break ; 
    212             fi 
    213             unset tmpfiles 
    214             set +A tmpfiles -- $( ls $1_mutex_[0-9]* 2>/dev/null ) 
    215         done 
     197        IGCM_card_CheckConflict $1 
    216198 
    217199        # Do the job 
     
    227209    fi 
    228210    IGCM_debug_PopStack "IGCM_card_WriteOption" 
     211} 
     212 
     213function IGCM_card_CheckConflict 
     214{ 
     215    IGCM_debug_PushStack "IGCM_card_CheckConflict" $@ 
     216 
     217    typeset isleep tmpfiles 
     218 
     219    # Watch for possible conflics : Check for other tmpfiles. 
     220    set +A tmpfiles -- $( ls $1_mutex_[0-9]* 2>/dev/null ) 
     221    ((isleep=0)) 
     222    while [ ${#tmpfiles[@]} -gt 0 ] ; do  
     223        echo "Conflict between two processes working on " $1 "!!!" ${tmpfiles[@]} 
     224        sleep 1 
     225        ((isleep=isleep+1)) 
     226        if [ isleep -gt 20 ] ; then 
     227            echo "Too many loops waiting for other process working on " $1 ". We continue." 
     228            echo "You should see if one process of your run or post-treatment may have terminated suddenly." 
     229            echo "Afer, you should erase this(those) file(s) : " ${tmpfiles[@]} 
     230# Send a mail to USER ?? 
     231            break ; 
     232        fi 
     233        unset tmpfiles 
     234        set +A tmpfiles -- $( ls $1_mutex_[0-9]* 2>/dev/null ) 
     235    done 
     236 
     237    IGCM_debug_PopStack "IGCM_card_CheckConflict" 
    229238} 
    230239 
Note: See TracChangeset for help on using the changeset viewer.