Jump to content

Primož Gabrijelčič

  • Content Count

  • Joined

  • Last visited

  • Days Won


Primož Gabrijelčič last won the day on June 3 2020

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

Community Reputation

198 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č

    How to ADD CodeLibrarian snippets database?

    No, I never did any work on CodeLibrarian (as far as I can remember).
  2. Primož Gabrijelčič

    Planning for V4 (FMX support)

    V3 works with VCL/command line/service. V4 *will* also support FMX (current development v4 version does not).
  3. Primož Gabrijelčič

    Planning for V4 (FMX support)

    I'm only using Delphi tools for threading and synchronization so the end result should work on all supported platforms. I only tested on Ubuntu running on WSL2 though.
  4. Primož Gabrijelčič

    Planning for V4 (FMX support)

    There is work being done (sporadically) in https://github.com/gabr42/OmniThreadLibrary/tree/v4-develop-2 Current status is: low-level tasks work on Linux, except when they don't and everything locks up hard. (And I have no idea yet why that happens.)
  5. Primož Gabrijelčič

    DSIWin32 ComObj

    That's an implementation bug in DSiWin32. I'll fix that, thanks for the report. DSiWin32 should work correctly in Win64. If not, that's a bug. (Yeah, indeed, naming ...)
  6. Primož Gabrijelčič

    Messageloop in Omnithread task

    By default, an OTL task does not process windows messages (which is requirement for TTimer to work). To enfore windows message processing, call the MsgWait method of your task controller interface before running/scheduling the task. Like this: task := CreateTask(TWorker.Create()).MsgWait.Run; Read more here: http://www.omnithreadlibrary.com/book/chap07.html#lowlevel-tomniworker-msgwait
  7. Primož Gabrijelčič

    Messageloop in Omnithread task

    Variant 1: Use a 'procedure' worker (`procedure Worker(const task: IOmniTask)'). Then you can implement your message loop inside. Variant 2: Use a `TOmniWorker` descendant (as in my example). It will implement its own message loop. Variant 2a: Override parts of the TOmniWorker message loop (but I actually don't remember anymore how that is done 😠 ). You can handle most stuff with Variant 2. In addition to timers you can call Task.RegisterWaitObject to connect code to any waitable handle. See demo 31_WaitableObjects for more information. Read more here: http://www.omnithreadlibrary.com/book/chap07.html#lowlevel-iomnitask-registerwaitobject.
  8. Primož Gabrijelčič

    Messageloop in Omnithread task

    For a timer, call Task.SetTimer and timer event will be called automatically. Something like this: uses OtlTaskControl; type TWorker = class(TOmniWorker) protected function Initialize: boolean; override; public procedure TimerCallback; end; function TWorker.Initialize: boolean; begin Result := inherited Initialize; if Result then Task.SetTimer(1, 100, TimerCallback); end; procedure TWorker.TimerCallback; begin // called every 100 ms end; var task: IOmniTaskControl; task := CreateTask(TWorker.Create()).Run;
  9. Primož Gabrijelčič

    [Q] OmniThreadLibry AV at Task.Invoke

    Please provide a minimal program that demonstrates the problem.
  10. Primož Gabrijelčič

    10.4.1 Released today

    Long, long time ago 🙂 A quick google search found out that it was introduced in Delphi 4: http://www.blong.com/Conferences/DCon99/VCLSourcery/VCLSourcery.htm. Kudos to @blong who keeps 20 year old posts alive on the web!
  11. Primož Gabrijelčič

    10.4.1 Released today

    And on other systems it's just a wrapper around pthread_rwlock.
  12. Primož Gabrijelčič

    Omnithread DELPHI, many calls in the same function

    This is actually a COM problem, I believe, and I know almost nothing about COM, so please consider that my thinking may be entirely wrong. I believe that you are having problems because you initialize your server in tmApartment mode but then access it from multiple threads. http://docwiki.embarcadero.com/RADStudio/Sydney/en/Choosing_a_Threading_Model says for tmApartment: " All client calls use the thread in which the object was created." And the object is created in the main thread. Does your code work if you use TThread instead of OTL to run async tasks?
  13. Primož Gabrijelčič

    Omnithread DELPHI, many calls in the same function

    I'm very sorry but I really don't speak any Frech. Can you please translate your question?
  14. Primož Gabrijelčič

    Sample for TWaitFor (or something similar)

    For Synchronize mechanism to work, console application should be calling function CheckSynchronize from System.Classes repeatedly. You can do that from the message processing loop.
  15. Primož Gabrijelčič

    Sample for TWaitFor (or something similar)

    If Synchronize is not working (can't tell why without your code), use Queue with a record containing (data, result, flag) and wait for main thread to set the flag. Like this: var res, data: ... flag: boolean; flag := false; TThread.Queue(nil, procedure begin res := Process(data); flag := true; end); while not flag do Sleep(0); Or make 'flag' an event and wait on it.