Jump to content

taz

Members
  • Content Count

    2
  • Joined

  • Last visited

Posts posted by taz


  1.  

    2 hours ago, Remy Lebeau said:

    This is better handled using a waitable mutex or other synchronization object.  The thread can wait on the object when it has nothing else to do, and another thread can signal the object to wake up the waiting thread.

    Agreed! it is always better to use existing well tested code instead of writing your own. I just added a safe use of the method to complete the picture.

    2 hours ago, Vincent Parrett said:

    This ^ is also a LOT faster than TThread.Resume

    Good to know, I had no idea.


  2. On 3/16/2022 at 7:56 PM, David Heffernan said:

    I don't think any amount of care can solve the issues there

    Just set a flag and call suspend from inside the thread it self. That will make sure that the thread code is not left in an unstable state it should have the same effect as using a locked mutex from the thread.

     

    Resuming though will have to be done from a 3rd party ee the main thread or some thread manager perhaps. 

    In any case, imagination is our limit.

×