[Gllug] Atomic increment/decrement
t.clarke
tim at seacon.co.uk
Wed Aug 7 13:39:54 UTC 2002
I have no ideas about mutexes - never fortunately had the need.
But I do remember many years ago having to do something vaguely similar on
a TI990 computer.
As I recall, the fundamental issue was one of getting the CPU to do an atomic
operation (of any sort) by first using a atomic 'test and set' cpu opcode.
The routine was in assembler and did something along the lines of
test and set a flag word
if the set succeeded you have control so do the atomic operation
and reset the flag word
if no success spin for a bit and try again
The whole thing depended on an atomic cpu test-and-set instruction and was
written in assembler.
I assume that unless the C language supports such a test-and-set cpu instruction
directly, you will have do write something in assembler to gain access to the
Intel X86 opcodes directly.
Tim
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list