Hi, I am new to this maillist. I have a small (but anonying) problem about raising exception in Delphi, which I can't find a good answer anywhere. I hope someone could shed me some light on it.

My question is: "Is raising Exception threadsafe in Delphi?" To be clear, it is not about the "raising" part, but the "Exception" part.

The "Exception" class in SysUtils unit has a serie of constructors Create*Fmt*() that combines "Format" functionality into the constructor. When I examine its source I found out those constructors all use the "Format(Format, Args)" routine. However, the Delphi documentation clearly stated that the "Format(Format, Args)" routine is NOT threadsafe. So, I think it also implies that the Exception class constructors that use them are NOT threadsafe, which means, raising an exception using the Create*Fmt* constructor is NOT threadsafe!(?!)

After discovering this problem, I coded my own "threadsafe" version exception class which uses the threadsafe "Format(Format, Args, FmtSettings)" routine, feeding it a per-thread copy of FormatSettings.

Yes, you can call me paranoid, because even I have the same feeling. So I really want to know whether my suspect is true or I am practising something that is not necessary...

------
.dlrow eht htiw thgir s'lla ,nevaeh sih ni si doG

_________________________________________________________________
与联机的朋友进行交流,请使用 Live Messenger; http://get.live.com/messenger/overview
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to