<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3354" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>In C++ this is a classical block enclosement. I
have used for few years in Delphi with interfaces. I was badly surprised that
there are some issues when you try to use it in Lazarus, but with some code
changes I think I have worked it around, and so far it seems to work in
Lazarus too, just with some limitations ( Destructors as example ).</FONT></DIV>
<DIV><FONT face=Arial size=2>In Delphi however there is a different problem. In
C++ the order of destruction will be exactly opposite of the order of creation.
There is no such guarantee in Delphi, so having 2 locks declared leads to
problems due to wrong order of destruction. This is yet another example where
C++ simply shines ;-) .</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV> With best regards,<BR> Boian Mitov</DIV>
<DIV> </DIV>
<DIV>--------------------------------------------------------------------<BR>Mitov
Software<BR><A
href="http://www.mitov.com">http://www.mitov.com</A><BR>--------------------------------------------------------------------</DIV>
<DIV> </DIV>
<DIV> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=hgourvest@progdigy.com href="mailto:hgourvest@progdigy.com">Henri
Gourvest</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=fpc-devel@lists.freepascal.org
href="mailto:fpc-devel@lists.freepascal.org">FPC developers' list</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, July 31, 2008 6:29
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [fpc-devel] Re: Multi
threading support</DIV>
<DIV><BR></DIV>
<DIV dir=ltr>sorry, it is also my idea :D<BR>I recently written a new light db
interface for firebird, to simplify queries<BR>and auto commit transactions
(context)<BR><BR> with pool.GetConnection.newContext do <- start
transaction<BR> Execute(newCommand('DELETE FROM COUNTRY
WHERE COUNTRY = ?'), [1]);<BR> <- commit/rollback
transaction<BR><BR>I also remember MS DirectShow SDK (to write codecs) use an
object allocated in the stack to syncronyse critical sections, it look like
our trick with the interface<BR></DIV></BLOCKQUOTE></BODY></HTML>