Queue Threading sProgressBar

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #36051
    mboloz
    Participant

    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…

    #51591
    Stertor
    Participant

    maybe this will help.

    #51592
    mboloz
    Participant

    🙁 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

    #51595
    mboloz
    Participant

    its 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…

    #51597
    CheshireCat
    Participant

    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!

    #51596
    mboloz
    Participant
    '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?

    #51598
    CheshireCat
    Participant

    Sorry for missing file, here is the complete demo with all files:

    [attachment=6667:Queue Thread.zip]

    #51599
    mboloz
    Participant
    '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

    #51600
    Stertor
    Participant

    ЧеширскийКот, он только-только стал изучать потоки, могу представить, как он разбирается в вашем примере )

    Чем не устраивают критические секции? Просто вынести процедуру заполнения прогрессбара в основной поток (с помощью Synchronize) и все.

    К тому же, в этом случае отпадают танцы с бубном около Tgauge, см. пример:

    #51593
    CheshireCat
    Participant

    Hello 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)!

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.