pthread_spin_lock

[email protected] Tue, 30 Jan 2007 23:10:09 +0200
Newsgroups gmane.linux.real-time.rtlinux.general
Message-ID <[email protected]>
--===============1925139149==
Content-Type: multipart/alternative; 
	boundary="----=_Part_117389_20306293.1170191409083"

------=_Part_117389_20306293.1170191409083
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello,

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.

Deniz

------=_Part_117389_20306293.1170191409083
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

------=_Part_117389_20306293.1170191409083--

--===============1925139149==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Rtl mailing list
[email protected]
http://hq.fsmlabs.com/mailman/listinfo/rtl
http:/www.rtlinux-gpl.org/
--===============1925139149==--