要此函数什么用?
vckbase上找到此函数的详细说明
InterlockedExchangeAdd 参数1为PLONG类型,参数2为LONG类型。此函数将参数2赋给参数1指向的值 那我代码中
InterlockedExchangeAdd( &bLineLeftOfBlock[ bRFSThreadControlFlag], gpSessionState->BufLine);
改为:
bLineLeftOfBlock[bRFSThreadControlFlag]=gpSessionState->BufLine;
不也一样?这函数起不多于?
还望达人解答~~

解决方案 »

  1.   

    Mackz(在相互) ( ) 信誉:115    Blog   加为好友  2007-06-25 09:40:09  得分: 0  
     
     
       你认为多余就多余吧。不用好了。
      
     
    ==================================如果这样的话我来发帖我有问题啊?
    当然是为了请教有何区别,或者会造成啥不良影响。
    微软也肯定不是闲得慌,去写一个不能简化任何步骤地函数。
      

  2.   

    大不一样。InterlockedXxx()函数-〉同步机制。The InterlockedExchangeAdd function performs an atomic addition of Value to the value pointed to by Addend. The interlocked functions provide a simple mechanism for synchronizing access to a variable that is shared by multiple threads. The threads of different processes can use this mechanism if the variable is in shared memory.The variables for this function must be aligned on a 32-bit boundary