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 ).
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 ;-) .

  With best regards,
    Boian Mitov

--------------------------------------------------------------------
Mitov Software
http://www.mitov.com
--------------------------------------------------------------------


  ----- Original Message ----- 
  From: Henri Gourvest 
  To: FPC developers' list 
  Sent: Thursday, July 31, 2008 6:29 AM
  Subject: Re: [fpc-devel] Re: Multi threading support


  sorry, it is also my idea :D
  I recently written a new light db interface for firebird, to simplify queries
  and auto commit transactions (context)

    with pool.GetConnection.newContext do <- start transaction
      Execute(newCommand('DELETE FROM COUNTRY WHERE COUNTRY = ?'), [1]);
    <- commit/rollback transaction

  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
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to