[Overview][Procedures and functions][Index] Reference for unit 'cthreads' (#rtl)

Reference for unit 'cthreads'

Initialize the thread manager with a POSIX thread manager


The CThreads unit initializes the system unit's thread management routines with an implementation based on the POSIX thread managing routines in the C library. This assures that C libraries that are thread-aware still work if they are linked to by a FPC program.

It doesn't offer any API by itself: the initialization section of the unit just initializes the ThreadManager record in the System unit. This is done using the SetCThreadManager call

The cthreads unit simply needs to be included in the uses clause of the program, preferably the very first unit, and the initialization section of the unit will do all the work.

Note that including this unit links your program to the C library of the system.

It makes no sense to use this unit on a non-posix system: Windows, OS/2 or DOS, therefor it should always between an ifdef statement:

program myprogram;

  {$ifdef unix}cthreads{$endif},
   classes, sysutils;

The Lazarus IDE inserts this conditional automatically for each new started program.

Documentation generated on: Nov 14 2015