[Lazarus] Free Pascal and Lazarus learning center

Michael Schnell mschnell at lumino.de
Mon Feb 1 11:21:45 CET 2016


On 01/31/2016 11:10 PM, Anthony Walter wrote:
> Thanks for the idea Bo. I'll put it near the top of my queue.
>
+1

IMHO the knowledge about the  (great)  thread Features of Lazarus are by 
far not spread wide enough.

The "lesson" should include:

  - Motivation for the usage of threads:
  -     - long winding calculations
  -     - blocking sockets and other hardware / system interface
  -     - exploiting multi-core hardware
  - Different programming Paradigms for Main Thread and Worker Threads
  -     - Main thread: Event driven (never sleep ! )
  -     - one-shot Worker threads
  -     - cyclic Worker Thread
  -     -     - "wake up" e.g.  by blocking interfaces,TEvent or 
CriticalSection
  -     -     - polling with sleep (trading performance against latency)
  - Worker Thread to Main Tread Events:
  -     - TTherad.Synchonize
  -     - TThread.Queue
  -     - Application.ProcessMessages (IMHO less important since we have 
TThread.Queue in FPC 3.x)
  -     - using "Event data transport classes" to be used as an argument 
of TThread.Queue
  - Data integrity
  -     - "Thread safe"
  -     - CriticalSection
  -     - TThreadList
  - Creating a Thread pool to prevent overhead for creating and 
destroying worker threads.
- Advanced:
-      - Threads and DLL/so

...


-Michael




More information about the Lazarus mailing list