Board index » delphi » THREADS EXAMPLE "Prgrsbar"



Hello folks

Under delphi 5 examples you'll find prgrsbar dpr. exemple
with two threads together with the main thread;

When you run this example in IDE it seems to work
          create thread1
          stop thread1 etc
However if you do it several times it says the thread is still executing
although the
 thread clearely shows the thread has  disappeared.

Simplyfing the program to main thread + one created
and adding some listboxes with the (INTTOSTR(cardinal(amessage.Wparam)) and

mythread1.thread1 shows the messages sent when the thread is done

Debugging into the Threaddone procedure shows that
(Mythread1.threadID= cardinal(amessage.wparam)) is sometimes false.

This happens often in the IDE environment

but almost never when you run the example compiled EXE directly under

Keeping track of when and which thread is done executing and setting the
boolean Threadactive to false is not sure to happen always.
It seems to me that the windowsmessage of thread done is not always the
correct one.

Sometimes you'll able to see the problem after 3 create/stop threads
sometimes it doesn't give trouble after 50 create/stop.  

Question1:is there a more secure way to check if a threads has stopped,
without "message" to threaddone

We would like to use a thread to read interrupt driven  SMPTE time-code
PCI TIME-code reader cards to be able to broadcasting synchronized
on HOLLYWOOD and other SOAP programs in Europe 100% ON AIR +
1 000.000 + Spectators .so we need bomb proof soft.

Question2:Has anybody experience with windriver.sys or winrt.sys
               polling/interrupt driven soft,direct access to ports
               we working on adrienne timecode reader or Alperman velte
               with some success but it is not 100% fail save

We currenty use RT BP7 pascal program with interrupts ,stack switching on
NT network + 4 serial ports without trouble for years .We hope to upgrade

Thanks for any hints



In article <01c0dfa0$f9fc5940$>, Kilroy wrote:
> Under delphi 5 examples you'll find prgrsbar dpr. exemple
> with two threads together with the main thread;

I never looked at that but you may get some hints by reading through these:

Tutorial on thread programming in Delphi

Handling exceptions in a thread,1410,10452,00.html

Peter Below (TeamB)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.


many thanks Peter,

Eddy (Kilroy)

Peter Below (TeamB) /  prgrsbar dpr. exemple

Other Threads