Re: what to use (sem/spinlock/etc)....

From: Paulo Marques
Date: Mon Feb 16 2004 - 10:23:52 EST


RANDAZZO@xxxxxxxxxxx wrote:

I have a register on my hardware that I write to to increment a counter....
..all I want to do is make sure that only one "task" writes at a time, thus to not corrupt the value......

=EXAMPLE

Task A
- Write new Value to hardware
- Increment Hardware counter
- DONE

Task B
- Write new Value to hardware
- Increment Hardware counter
- DONE

..This will most likely not occur in a inthandler, but may....

...I have to make sure that Task A is "done" before "Task B" or any others
can do their writing....

...any opinion of what I should use....

You can read the "Unreliable Guide To Locking" from Rusty Russell at:

http://www.kernel.org/pub/linux/kernel/people/rusty/kernel-locking/

I hope this helps,

--
Paulo Marques - www.grupopie.com

"In a world without walls and fences who needs windows and gates?"

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/