Unit 'Classes' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]

TThread.CreateAnonymousThread

Execute code in an anonymous thread.

Declaration

Source position: classesh.inc line 2346

public class function TThread.CreateAnonymousThread(

  aProc: TProcedure

):TThread;

class function TThread.CreateAnonymousThread(

  aProc: TThreadMethod

):TThread;

Description

CreateAnonymousThread will create an instance of a TThread descendant and calls aProc in this procedure. This can be used to quickly execute a method in another thread without having to expliticly declare a thread for such purposes. It returns the created TThread instance, which can be checked for termination etc.

Note that this method differs slightly from Delphi in that FPC does not yet support anonymous methods, so the signature of aProc differs slightly.

See also

TThread.CheckTerminated

  

Check if the current thread has finished executing.


Documentation generated on: Nov 23 2024