Search code examples
multithreadingdelphipreemptive

Preemptive Multithreading in Delphi


I've read about Preemptive Multithreading here and here.

Is there a way to do this in Delphi and how does this compare (advantages and disadvantages) to other methods of threading in Delphi?


Solution

  • The "other methods" you're referring to all seem to be using the operating system's underlying threading capability -- which is preemptive. In other words, choose whichever you find most convenient, and it'll be preemptive.

    Getting non-preemptive (aka cooperative) threading requires a bit of extra work, typically by converting threads to "fibers".