Board index » delphi » Re: Nice article: "The Free Lunch is Over: A Fundamental Turn TowardConcurrencyin Software"
Charles McAllister
![]() Delphi Developer |
Re: Nice article: "The Free Lunch is Over: A Fundamental Turn TowardConcurrencyin Software"2005-01-09 06:22:10 AM delphi0 Eric Grange writes: Quote>Concurrent programming should be made easier by compiler technology. dealing solely with local vars; and const params... function TSomeObject.GetResult(const AParam1, AParam2: Integer; var AParam3: Integer): Integer; var I: Integer; begin // non threadable code... AParam3 := 0; // threadable code (dumb example i know) Result := 0; for Index := 1 to AParam1 do Result := Result + AParam2; end; now if the function is called... FValue := MyObject.GetResult ...access to FValue would have to be synchronized automatically by the compiler. of course you'd get better results by writing thread and synch code yourself, but 1) it wouldn't look pretty and 2) you might make a mistake in writing all that extra code. (much like pros/cons of writing ASM code) could be a compiler option where the compiler wouldn't do any of this extra thread stuff, unless {$THREADING ON} explicitly stated. |