Test and Set

Test and Set

Post by Yao-Lu Tsa » Sun, 08 Oct 1995 04:00:00

Hi, everybody,

I am porting our product to a HP 9000 machine. It requires
a test-and-set atomic operation function in our product.
We have implemented this function in assembly codes on many
platforms, such as solaris, linux, scounix, and so on, as
follows :

int test&set(int *latch)
    load "1" to regester_1
    exchange the contents in regester_1 with *latch
    return the value in *latch


However, I can't find any assembly instruction to do
'exchange' on HP machine(with PA CPU). Anyone can
help me to solve this problem ?

Thanks in advance.
Yao-Lu Tsai from Taiwan


                Project Manager at OODB team,
                  Syscom Computer CO., Taiwan.
                Tel : (02) 741-8010 EXT 8857