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   |
 |
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
|
|
|
 |
|
Core multithread dangers
By: hojtsy on Fri, 03 February 2006 23:09
|
 |
|
Re: Core multithread dangers
By: mirek on Fri, 03 February 2006 23:51
|
 |
|
Re: Core multithread dangers
By: mirek on Sat, 04 February 2006 12:14
|
 |
|
Re: Core multithread dangers
By: hojtsy on Sat, 04 February 2006 14:53
|
 |
|
Re: Core multithread dangers
By: mirek on Sat, 04 February 2006 18:20
|
 |
|
Re: Core multithread dangers
By: mirek on Mon, 06 February 2006 11:46
|
 |
|
Re: Core multithread dangers
By: hojtsy on Mon, 06 February 2006 14:18
|
 |
|
Re: Core multithread dangers
By: mirek on Mon, 06 February 2006 14:24
|
 |
|
Re: Core multithread dangers
By: hojtsy on Mon, 06 February 2006 14:37
|
 |
|
Re: Core multithread dangers
By: mirek on Mon, 06 February 2006 14:52
|
 |
|
Re: Core multithread dangers
By: mirek on Mon, 06 February 2006 19:19
|
 |
|
Re: Core multithread dangers
By: hojtsy on Tue, 07 February 2006 09:59
|
 |
|
Re: Core multithread dangers
By: fudadmin on Tue, 07 February 2006 11:09
|
 |
|
Re: Core multithread dangers
By: unodgs on Tue, 07 February 2006 11:41
|
 |
|
Re: Core multithread dangers
By: fudadmin on Tue, 07 February 2006 12:49
|
 |
|
Re: Core multithread dangers
By: mirek on Tue, 07 February 2006 14:42
|
Goto Forum:
Current Time: Mon Aug 25 09:37:19 CEST 2025
Total time taken to generate the page: 0.06249 seconds
|