Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » SpinLock
SpinLock [message #44226] Sat, 31 January 2015 15:13 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
New MT synchronization tool, primitive extremely lightweight SpinLock (busy wait mutex). sizeof is 4 bytes, is Moveable (means we can store thousands of them into Vector).
Re: SpinLock [message #44459 is a reply to message #44226] Fri, 13 March 2015 22:12 Go to previous messageGo to next message
aftershock is currently offline  aftershock
Messages: 143
Registered: May 2008
Experienced Member
Hi,



How Can I use spinlock?
bool m::add()
{



int free_index;
{
SpinLock _;


}


Is this correct? Should spinlock be static SpinLock _;?

or

static SpinLock _;

{
SpinLock::Lock l(_);
}

A.

[Updated on: Fri, 13 March 2015 22:30]

Report message to a moderator

Re: SpinLock [message #44463 is a reply to message #44459] Sat, 14 March 2015 11:37 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
You basically use SpinLock as Mutex. So second one is correct.

Note that SpinLock has limitations - it is busy wait and it is not reentrant...
Previous Topic: GLDraw
Next Topic: ide: Now able to detect and display binary files
Goto Forum:
  


Current Time: Thu Mar 28 16:36:58 CET 2024

Total time taken to generate the page: 0.00456 seconds