Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-06

A Thread Manager demo

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

[ I first posted this to the Lazarus mailing list, but I think my questions are actually more related to FPC itself. I apologize for the cross posting in advance. ]

I'm busy writing a Thread Manager demo in FPC & Lazarus to help me understanding threads better. This demo will then serve as a good example of how to use threads and synchronization. No better way to learn something than writing code! :)

A quick summary of what I want to do:
-------------------------------------------------------
* You can create a Sync Object by selecting one of the following types: No Synchronization, Critical Section, Mutex or Semaphore.

* Then you can create as many threads as you want. Default thread priority is Normal. Each thread counts down from 100% to 0% at which point the thread is completed.

* A grid will show you all the threads you created. Each grid line represents a thread.

* You can Stop, Resume or Kill an individual thread.

* You can change an individual thread's Priority (tpIdle thru tpTimeCritical), though under Linux I know the thread priority is a integer value. tpXXX values will be displayed in the grid.

* You can also act on all threads: Kill All, Stop All and Resume All.

Questions:
------------------
1. Is there any other synchronization methods that FPC supports?

2. Is there a platform independent way of creating a Mutex? eg: A CreateMutex() function that maps to each platforms specific implementation. Something like the TCriticalSection class.

3. Same as (2), but for Semaphores.

Graeme Geldenhuys General error, hit any user to continue.

Reply by email