- This topic has 9 replies, 3 voices, and was last updated 10 years, 8 months ago by Stertor.
-
AuthorPosts
-
February 23, 2014 at 7:12 am #36051mbolozParticipant
Hello there,
I have some example here..
[attachment=6663:Queue Thread.rar]
i have a button “execute” that proccess a thread that fill sProgressBar from 0-Max
but when i execute the button again and again, there is an overlaping thread, can someone fix this code
what i want is queue threading, for example if i click the button three times
the progressbar will execute from 0-max three times but waiting each execute thread over, not by overlaping it
Need Help please…
February 23, 2014 at 7:55 am #51591StertorParticipantmaybe this will help.
February 23, 2014 at 7:56 am #51592mbolozParticipant🙁 Thanks dude, but not yet like what i wanted..
try to click the button twice or more, the thread is overlaping by new execute,
what i want is, thread execute twice but waiting one by one done
February 23, 2014 at 8:12 am #51595mbolozParticipantits not about detect the thread already running or not, i precisely need the thread execute many time
but the progress waiting each, not by overlaping by new execute
sorry for bad english…
February 23, 2014 at 9:59 am #51597CheshireCatParticipantHello,
you can use my class for save threads in a waiting list. Look at the attached demo 🙂
[attachment=6666:Queue Thread.zip]
Note:
I use TGauge instead TProgressBar, a TProgressBar is not suitable in threads!
February 23, 2014 at 10:29 am #51596mbolozParticipant'CheshireCat' wrote:Hello,
you can use my class for save threads in a waiting list. Look at the attached demo 🙂
[attachment=6666:Queue Thread.zip]
Note:
I use TGauge instead TProgressBar, a TProgressBar is not suitable in threads!
:a3: hey thanks, but the fmain.pas i cant found it, would you upload it again?
February 23, 2014 at 10:31 am #51598CheshireCatParticipantSorry for missing file, here is the complete demo with all files:
[attachment=6667:Queue Thread.zip]
February 23, 2014 at 10:42 am #51599mbolozParticipant'CheshireCat' wrote:Sorry for missing file, here is the complete demo with all files:
[attachment=6667:Queue Thread.zip]
:a3: many thanks, works perfectly… case closed
February 23, 2014 at 11:04 am #51600StertorParticipantЧеширскийКот, он только-только стал изучать потоки, могу представить, как он разбирается в вашем примере )
Чем не устраивают критические секции? Просто вынести процедуру заполнения прогрессбара в основной поток (с помощью Synchronize) и все.
К тому же, в этом случае отпадают танцы с бубном около Tgauge, см. пример:
February 23, 2014 at 6:50 pm #51593CheshireCatParticipantHello Stertor,
your code example is correct but it doesn't solve the problem. If you click on the button during ProgressBar is filling you don't create a new thread, it starts the Execute method from the begin only (same Thread-ID). Each click on the button should create a new thread that also runs to the end before the next is executed (various Thread-ID)!
-
AuthorPosts
- You must be logged in to reply to this topic.