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 » U++ Library support » U++ Library : Other (not classified elsewhere) » I request the implementation of callback5
Re: I request the implementation of callback5 [message #49837 is a reply to message #49821] Tue, 15 May 2018 20:26 Go to previous messageGo to previous message
aftershock is currently offline  aftershock
Messages: 143
Registered: May 2008
Experienced Member
it does not seem to be work..

Instead , I had to do this
        Atomic wait_until;
	wait_until.store ( 1, std::memory_order_relaxed );
	threads[free_index].Run ( [&,a,bot1,result_mode, stat_group_id]
	{
		VectorMap<String, double> params2 = pick ( params );
		wait_until.store ( 0, std::memory_order_relaxed );
	
		execute_bot_in_background ( bot1, a, pick ( params2 ), result_mode, stat_group_id );
	
	
	} );
	
	while ( 1 )
	{
		// memory barrier for visibility semantics
	
	
		// spin wait
		if ( !wait_until.load ( std::memory_order_acquire ) )
		{
			break;
		}
	}


I wonder if that was safe
threads[free_index].Run ( THISBACK5 ( execute_bot_in_background, bot1, a, pick(params), result_mode, stat_group_id ) );

How was params copied? Could it happen by the time pick would transfer it.. params could go out of scope faster?


By the way, using lambda's value copying is that thread safe?

[Updated on: Tue, 15 May 2018 21:31]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: design flaw in scatterctrl?
Next Topic: How can I turn off soring in ArrayCtrl?
Goto Forum:
  


Current Time: Sat Apr 26 09:50:14 CEST 2025

Total time taken to generate the page: 0.00946 seconds