Sign in Join

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

Mailing lists / fpc-pascal / 2010-02

C thread callbacks

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Wimpie Nortje

Hi

I have a C library that uses threads. These threads use callbacks into my pascal for events. What must happen for the pascal events handlers to be able to safely access the main thread's resources?

This is the same situation where I would use TThread.Synchronize if the threads were TThread objects.

Jonas Maebe
to Wimpie Nortje
Wimpie Nortje wrote
I have a C library that uses threads. These threads use callbacks into my pascal for events. What must happen for the pascal events handlers to be able to safely access the main thread's resources?

The same as what must happen for C event handlers to access those resources.

This is the same situation where I would use TThread.Synchronize if the threads were TThread objects.

Then you must implement such a mechanism in the C program as well, or some other way to synchronise with its main thread.

Jonas