Jump to content

Primož Gabrijelčič

  • Content Count

  • Joined

  • Last visited

  • Days Won


Primož Gabrijelčič last won the day on April 30

Primož Gabrijelčič had the most liked content!

Community Reputation

152 Excellent


Technical Information

  • Delphi-Version
    Delphi 10.2 Tokyo

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Primož Gabrijelčič

    OmniThreadPool race conditions

    Yes. The answer does not depend on the rest of the statement 😞 Thread pool does not get destroyed unless you destroy it in the code. A thread from a thread pool does not get destroyed while it is running your code. You can process thread pool events to be informed when a thread will be destroyed: http://www.omnithreadlibrary.com/book/chap07.html#lowlevel-threadpool-monitoring
  2. Primož Gabrijelčič

    Changes in Parallel Library

    "This also appears to affect OmiThreadLibrary" without any accompanying code does not mean anything. It was probably a moon phase, or Mercury in retrograde, not OTL.
  3. Primož Gabrijelčič

    Passing parameter to ThreadDataFactory

    OK, now for reals 🙂 (Sorry for the wrong answer before. You did not provide a test project so I did not open my Delphi at all and just guessed at the answer.) As the SetThreadDataFactory doesn't yet support anonymous method factory, your best bet is to use a singleton to store parameters and provide a factory. Just a sketch of a solution: type TThreadFactory = class public class var Handle: THandle; class function Make: IInterface; end; FConnectionPool := CreateThreadPool('Connection pool'); TThreadFactory.Handle := aHandle; FConnectionPool.SetThreadDataFactory(TThreadFactory.Make);
  4. Primož Gabrijelčič

    Passing parameter to ThreadDataFactory

    Yeah, as it turned out, SetThreadDataFactory doesn't yet support an anonymous method factory. Have to fix that ... 😞 I'll write a better answer soon (today).
  5. Primož Gabrijelčič


    Ah, SetThreadDataFactory actually doesn't support taking an anonymous function as an argument. An oversight that I should fix in a future. So - pass a normal function or method name to SetThreadDataFactory, not an anonymous method. (And I will amend my answer to your previous question on that topic.)
  6. Primož Gabrijelčič

    Passing parameter to ThreadDataFactory

    You can just use aConfig inside the anonymous function. Compiler will capture it for you. function TFConfig.CreateThreadPool(aHandle : THandle ; aConfig : rConnectionConfig ; aValue: string) : iOmniThreadPool; begin result := otlThreadPool.CreateThreadPool(aValue); result.MaxExecuting := result.NumCores; result.SetThreadDataFactory ( function: IInterface begin result:= MakeInterface(aHandle, aConfig); // implement MakeInterface end ); end;
  7. Primož Gabrijelčič

    About error handling in parallel.for

    Sorry, until you get us a reproducible test case, I cannot tell you anything.
  8. Primož Gabrijelčič

    way to send an object to the main thread from task

    Just use any of the mechanisms for sending data to the main thread (Task.Comm.Send, Task.Invoke). Or standard Delphi mechanisms (TThread.Queue). Or am I missing something?
  9. Primož Gabrijelčič

    using an array of with TOmniValue

    This works: program Project191; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, OtlCommon; type TpDataType = (dtNone, dtInteger, dtDateTime, dtString, dtBlob); rParameter= record Field : string; Value : Variant; AsValue : TpDataType; end; TParameters = TArray<rParameter>; var params, params2: TParameters; ov: TOmniValue; begin SetLength(params, 2); params[0].Field := 'a'; params[0].Value := 1; params[0].AsValue := dtInteger; params[1].Field := 'b'; params[1].Value := Now; params[1].AsValue := dtDateTime; ov := TOmniValue.FromArray<rParameter>(params); params2 := ov.ToArray<rParameter>; end. You will have to convert 'array of rParameter' to 'TArray<rParameter>'. TOmniValue has special support (FromArray, ToArray) for the latter but not for the former.
  10. Primož Gabrijelčič

    IDE Fix Pack 6.4.4 - failed to load layout

    Delphi 10.3.2, IDE Fix Pack 6.4.4 When I close a project with File, Close All, I get this error: This happens with all projects. Startup Layout.dst attached. @jbg Startup Layout.dst
  11. Primož Gabrijelčič

    Generic Command Line Parser for Delphi 10.3.x

    My approach: https://github.com/gabr42/GpDelphiUnits/blob/master/src/GpCommandLineParser.pas
  12. Primož Gabrijelčič

    IDE Fix Pack 6.4.3 breaks compilation

    Works great! Thank you for a prompt fix! (And thank you for IDEFixPack!)
  13. Primož Gabrijelčič

    IDE Fix Pack 6.4.3 breaks compilation

    I was wrong - it is CodeGenMod.Win32.VirtFinalSealed. When I disable it, the project can be rebuilt again.
  14. Primož Gabrijelčič

    IDE Fix Pack 6.4.3 breaks compilation

    What was the patch that did not get applied in 6.4.2 because of the change in 10.3.2? I'm pretty sure that everything worked fine with 6.4.2.
  15. Primož Gabrijelčič

    IDE Fix Pack 6.4.3 breaks compilation

    IDE Fix Pack 6.4.3 breaks compilation in Rio 10.3.2 for our flagship application. After compile or rebuild, I get [dcc32 Fatal Error] FAB .gRPC . pas ( 265): F2084 Internal Error: AV0D0F16E4(0D080000)-R0000000C-0 Wihout IDE Fix Pack, compilation works fine. Any suggestions?