>Don't think so. Well, it is safe on i386, but on other architectures,
>test_and_set_bit is not guaranteed to be atomic. [And I'm afraid that
Arggh I thought that test_and_set_bit() was atomic on all ports (since I
looked only its i386 implementation)!
I used test_and_set_bit() in lp to avoid races for SMP in lp_open() (not a
very critical part of the kernel though, since nobody noticed the race
also before I put test_and_set_bit() there; probably because /dev/lp0
usually is opened only from the printer spooler...).
At first I can see test_and_set_bit() very more helpful if
As second since it' s declared _not_ atomic in Linux, why i386 implement
extern __inline__ int test_and_set_bit(int nr, volatile void * addr)
__asm__ __volatile__( LOCK_PREFIX
^^^^^^^^^^^ why to lock in SMP if it' s not atomic?
"btsl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit),"=m" (ADDR)
So I' d like to know if test_and_set_bit() will forever remain declared
not atomic for all ports to know if I need to refix lp_open()...
PS. I explicit mentioned the use of test_and_set_bit() to fix not atomic
operation in lp_open() as first point in the patch comments I sent to
Linus with the patch itself.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to email@example.com