Jump to content

Primož Gabrijelčič

Members
  • Content Count

    246
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Primož Gabrijelčič


  1. Check the stack trace to see where this critical section is allocated from.

     

    If this is not possible with the FastMM that comes with Delphi (frankly, I don't use it and I have no idea), use FastMM from git and define FullDebugMode conditional.


  2. 5 minutes ago, Attila Kovacs said:

    For example, some of the exceptions are arriving as "string" into the final output collection instead as "exception".

    Without having a reproducible example, I have no idea.

    5 minutes ago, Attila Kovacs said:

    Do I need a new pipeline?

    Yes, you need a new pipeline. After a pipeline goes into CompleteAdding state, it cannot be "revived".

    • Thanks 1

  3. I don't know. Show us the code. You are probably doing something after that "WaitFor" and I don't know what.

     

    Quote

    where is no waitfor() but processing output right after "CompleteAdding", which is also confusing.

     

    What is confusing here? You don't have to wait for pipeline to terminate (WaitFor) to start processing its output.


  4. Of course you can run a pipeline without a WaitFor.

     

    You have different options to detect when a pipeline has finished its work.

     

    a) The main program can count the number of items sent to the pipeline and number of items returned from. (If there is a simple correspondence between two - for example if each input produces exactly one output.)

    b) The pipeline itself can detect that it has no more work and then it can signal this to the main program.

     

    When you detect a terminating condition, you can shut down the pipeline (with WaitFor) and you'll done.

     

    See the "folder scanner" in OTL examples folder for an example of the b) technique or read this chapter of the book: http://www.omnithreadlibrary.com/book/chap10.html#howto-webDownload


  5. There is none. Only the main thread should update the UI in a VCL application so if it is blocked, you're out of options.

     

    In theory, you could create a window purely by the Windows API and use it to show the progress, but that is probably much to much work. 

     

    Better solution would be to not block the VCL application at all.


  6. I'm usually doing such logging in a manner similar to the one Kas Ob. presented.

     

    I establish a logging queue. Usually a TOmniQueue as it does not require locking. 

    Then I create a logging thread. In essence it does just:

    while logQueue.Get(msg) do
      Log(ms);

    Each part of the program that wants to log, just creates a `msg` record containing whatever info you need to perform the logging (message, severity, timestamp, target file ...) and pushes it into the logging queue. That's it.

×