Mutex: Difference between revisions

Content added Content deleted
(Mutex en FreeBASIC)
No edit summary
Line 26: Line 26:


=Sample implementations / APIs=
=Sample implementations / APIs=
=={{header|8086 Assembly}}==
<code>LOCK</code> is a prefix that can be added to instructions that read a value then write back to it, such as <code>INC</code> and <code>DEC</code>. This prefix "locks" the memory bus, preventing other CPUs (if any) from accessing the same memory location at the same time as the CPU executing the "locked" instruction. The lock lasts until the locked instruction is complete, at which point the lock is released. This isn't used much on the original 8086 but it's been there since the beginning.

<lang asm> lock inc word ptr [ds:TestData] ;increment the word at TestData. Only this CPU can access it right now.</lang>


=={{header|Ada}}==
=={{header|Ada}}==