Changeset 27712 for lang/cplusplus/i3

Show
Ignore:
Timestamp:
01/01/09 03:54:56 (4 years ago)
Author:
saturday06
Message:

irq

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/i3/trunk/src/mol/include/mol/Mol.h

    r27708 r27712  
    7777class atomic : boost::noncopyable 
    7878{ 
    79     T t; 
     79    void* t; 
    8080public: 
    81     atomic(T t) : t(t) 
    82     { 
     81    atomic(T t) 
     82    { 
     83        store(t); 
    8384    } 
    8485 
     
    9899        void* tmp = NULL; 
    99100        memcpy(&tmp, &new_val, sizeof(new_val)); 
    100         return (T)InterlockedExchangePointer( 
     101        void* got = InterlockedExchangePointer( 
    101102            reinterpret_cast<void* volatile *>(&t), tmp); 
     103        T cooked; 
     104        memcpy(&cooked, &got, sizeof(cooked)); 
     105        return cooked; 
    102106    } 
    103107