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++ MT-multithreading and servers » Simple class to handle variables used by different threads
Re: Simple class to handle variables used by different threads [message #45060 is a reply to message #45059] Wed, 26 August 2015 05:01 Go to previous messageGo to previous message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

For me:
1) I decide, that common variables of all threads, I place to ThreadStore (analog of your ThreadSafe).
2) Most of variables not needed to place to ThreadStore class and it's locals for thread.
3) I plan and program custom processing for every member-variable of ThreadStore class.

Note (1), that most of Container type (Vectors, Arrays, Indexes) are not thread-safe!!!

Note (2), that Write/Read barrier is needed same way as mutexes/semafors for synchronisation data access. (Mutex/semafors - prevent inter-thread collision, Write/Read barriers - prevent inter-processor-cores collisions)

Your class uses only Write/Read barriers.
If you place under mutex of all ThreadSafe class and all it's member, then performance is become loss. Custom variable processing more fast and safe way.

----
PS
If I'm mistaken - pls correct.



SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}

[Updated on: Wed, 26 August 2015 05:42]

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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to just Post data ?
Next Topic: Mt.cpp broken compile using 9604 nightly snap-shot
Goto Forum:
  


Current Time: Sun Apr 28 23:45:17 CEST 2024

Total time taken to generate the page: 0.09318 seconds