[fpc-devel] Re: Multi threading support

Boian Mitov mitov at mitov.com
Thu Jul 31 15:32:47 CEST 2008


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20080731/ab25c6fa/attachment.html>


More information about the fpc-devel mailing list