flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Windows > Fasm 1.73 two threads write\read from value | 
  
| Author | 
  | 
              
| 
                  
                   Roman 22 Dec 2019, 06:23 
                  fasm 1.73 error cmpxchg rax, [val1] 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   Roman 22 Dec 2019, 06:35 
                  work fine
 
                  
                lock XCHG rax,[val1]  | 
              |||
                  
  | 
              
| 
                  
                   revolution 22 Dec 2019, 06:38 
                  If you have val1 aligned to a dword boundary then you can read and write the value from any thread without needing any locks. You will always get a fully written value, never any half written value.
 
                  
                If your program still crashes and val1 is aligned then I suspect your problem is with something else.  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.