Changeset 1186:b298ea2fcaad


Ignore:
Timestamp:
03/20/09 07:58:13 (3 years ago)
Author:
niam
Branch:
default
Message:

improved performance of lock operation in process sync chain

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/pcSyncProcessDataSingle.cc

    r1162 r1186  
    7474        } 
    7575 
    76         control.val = 0; 
     76        control.val = 1; 
    7777 
    7878        if (semctl(keeper, 0, SETVAL, control) == -1) 
     
    144144                        if (acquired) 
    145145                        { 
    146                                 operations[0].sem_op = -1; 
     146                                operations[0].sem_op = 1; 
    147147 
    148148                                semop(keeper, operations, 1); 
     
    189189                        if (acquired) 
    190190                        { 
    191                                 operations[0].sem_op = -1; 
     191                                operations[0].sem_op = 1; 
    192192 
    193193                                if (semop(keeper, operations, 1) == -1) 
     
    261261        } 
    262262 
    263         control.val = 0; 
     263        control.val = 1; 
    264264 
    265265        if (semctl(keeper, 0, SETVAL, control) == -1) 
     
    345345        } 
    346346 
    347         operations[0].sem_op = 0; 
     347        operations[0].sem_op = -1; 
    348348 
    349349        if (semop(keeper, operations, 1) != 0) 
     
    352352        } 
    353353 
     354        data = a_data; 
     355 
    354356        operations[0].sem_op = 1; 
    355  
    356         if (semop(keeper, operations, 1) != 0) 
    357         { 
    358                 throw exception::basic(exception::ERRMODULE_PCSYNCPROCESSDATASINGLE, SINGLEEX_SET, exception::ERRNO_ERRNO, errno, strerror(errno), __LINE__, __FILE__); 
    359         } 
    360  
    361         data = a_data; 
    362  
    363         operations[0].sem_op = -1; 
    364357 
    365358        if (semop(keeper, operations, 1) != 0) 
     
    412405        if (microseconds == 0) 
    413406        { 
    414                 operations[0].sem_op = 0; 
    415  
    416                 if (semop(keeper, operations, 1) != 0) 
    417                 { 
    418                         throw exception::basic(exception::ERRMODULE_PCSYNCPROCESSDATASINGLE, SINGLEEX_ACQUIRE, exception::ERRNO_ERRNO, errno, strerror(errno), __LINE__, __FILE__); 
    419                 } 
    420  
    421                 operations[0].sem_op = 1; 
     407                operations[0].sem_op = -1; 
    422408 
    423409                if (semop(keeper, operations, 1) != 0) 
     
    431417                unsigned long slept = 0; 
    432418 
    433                 operations[0].sem_op = 0; 
     419                operations[0].sem_op = -1; 
    434420                operations[0].sem_flg = IPC_NOWAIT; 
    435421 
     
    465451                                locked = false; 
    466452                        } 
    467                 } 
    468  
    469                 operations[0].sem_op = 1; 
    470                 operations[0].sem_flg = 0; 
    471  
    472                 if (semop(keeper, operations, 1) != 0) 
    473                 { 
    474                         throw exception::basic(exception::ERRMODULE_PCSYNCPROCESSDATASINGLE, SINGLEEX_ACQUIRE, exception::ERRNO_ERRNO, errno, strerror(errno), __LINE__, __FILE__); 
    475453                } 
    476454        } 
     
    543521        } 
    544522 
    545         operations[0].sem_op = -1; 
     523        operations[0].sem_op = 1; 
    546524 
    547525        if (semop(keeper, operations, 1) != 0) 
  • trunk/src/pcSyncProcessSection.cc

    r1162 r1186  
    6464 
    6565        operations[0].sem_num = 0; 
     66 
    6667        operations[0].sem_flg = 0; 
    6768 
     
    7273        } 
    7374 
    74         control.val = 0; 
     75        control.val = 1; 
    7576 
    7677        if (semctl(keeper, 0, SETVAL, control) == -1) 
     
    141142                        if (acquired) 
    142143                        { 
    143                                 operations[0].sem_op = -1; 
     144                                operations[0].sem_op = 1; 
    144145 
    145146                                semop(keeper, operations, 1); 
     
    187188                                if (acquired) 
    188189                                { 
    189                                         operations[0].sem_op = -1; 
     190                                        operations[0].sem_op = 1; 
    190191 
    191192                                        if (semop(keeper, operations, 1) == -1) 
     
    260261        } 
    261262 
    262         control.val = 0; 
     263        control.val = 1; 
    263264 
    264265        if (semctl(keeper, 0, SETVAL, control) == -1) 
     
    344345        } 
    345346 
    346         operations[0].sem_op = 0; 
    347  
    348         if (semop(keeper, operations, 1) != 0) 
    349         { 
    350                 throw exception::basic(exception::ERRMODULE_PCSYNCPROCESSSECTION, SECTIONEX_ACQUIRE, exception::ERRNO_ERRNO, errno, strerror(errno), __LINE__, __FILE__); 
    351         } 
    352  
    353         operations[0].sem_op = 1; 
     347        operations[0].sem_op = -1; 
    354348 
    355349        if (semop(keeper, operations, 1) != 0) 
     
    387381        } 
    388382 
    389         operations[0].sem_op = -1; 
     383        operations[0].sem_op = 1; 
    390384 
    391385        if (semop(keeper, operations, 1) != 0) 
Note: See TracChangeset for help on using the changeset viewer.