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 » Core multithread dangers
Re: Core multithread dangers [message #868 is a reply to message #845] Mon, 06 February 2006 11:46 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
Hojtsy, I have one MT trouble I would like to share....

It is about Ptr implementation. While current version is MT safe to my knowledge, it is inferior to previous one as it allocates shared data for the lifetime of Pte target.

Original version was able to delete shared data whenever no more pointer were pointing to it, something like

release prec:
if(--prec->n == 0) {
// MT!
prec->ptr->prec = NULL;
delete prec;
}

However, I do not see a way how to implement it without adding a lock to Pte, which is even worse. The trouble is that at the MT! point, Pte can be destructed and prec is not valid anymore....

(Just for record, ~Pte() { if(prec) prec->ptr = NULL; })

Hm, thinking about it, maybe single _global_ lock would do?

Mirek
 
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
Next Topic: SlaveProcess should be moved from Web to Core
Goto Forum:
  


Current Time: Mon Aug 25 17:20:59 CEST 2025

Total time taken to generate the page: 0.06137 seconds