Re: pthread_spin_lock

[email protected] Wed, 31 Jan 2007 06:06:29 +0100 (CET)
Newsgroups gmane.linux.real-time.rtlinux.general
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>
> According to man page of pthread_spin_lock "As the context switch overhead
> is saved, spinlocks usually give better performance on multi-processor
> systems than other synchronization methods"
>
> When i use spinlock for task syncing, it locks my box.
>
> threadA()
> {
> while(1)
> {
>   pthread_wait_np();
>   pthread_spin_lock(&lock);
>   ...
>   pthread_spin_unlock(&lock);
> }
> }
>
> threadB()
> {
> while(1)
> {
>   pthread_spin(&lock);
>   ....
>   pthread_spin_unlock(&lock);
> }
> }
>
> Whats is wrong am I doing ?
> Thank you.
>
Are you running on a SMP box and is it configured as SMP ?

hofrat
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFFwCPXnU7rXZKfY2oRAlWbAJ46RUa39m6HyIGgs7uQPeJEIwGQ2wCfdzID
94sXzqv0z3+g7rgZiT2bZNI=
=p1ZX
-----END PGP SIGNATURE-----
_______________________________________________
Rtl mailing list
[email protected]
http://hq.fsmlabs.com/mailman/listinfo/rtl
http:/www.rtlinux-gpl.org/