Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Delphi Multi thread example

Posted on 2013-05-17
3
1,448 Views
Last Modified: 2013-06-02
Hello,

Let's say I have a procedure called "DoItForALongTime" which runs for 30 seconds.

The user can start it clicking on the Start button.
But after starting the  "DoItForALongTime" procedure, the user should be able to click on the Start button again and again so as many  "DoItForALongTime" procedures can run at the same time (of course with delayed start).

I would like to have a small working Delphi application about this. It doesn't matter what the  "DoItForALongTime" procedure does, only it should last for at least 20 seconds.

I use Delphi 2010.

Thank you very much
0
Comment
Question by:starhu
3 Comments
 
LVL 26

Accepted Solution

by:
Sinisa Vuk earned 250 total points
ID: 39174238
I recommend to use TBMDThread. Get it from www.torry.net
OmniThreadLibrary is little complex but good alternative too. Using one of them you can easily set you "long" process as a working job.
0
 
LVL 15

Assisted Solution

by:mikelittlewood
mikelittlewood earned 250 total points
ID: 39189982
I would also take a look at the JVCL open source components.
They have a TJVThread set of components.
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 39190869
you might want to consider your approach
technically
hitting the button adds a todo item to a list
this list is checked by a thread periodically
when a item is on the list, it is removed and a thread is started to do the work
if you want only 1 thread to run at a time, you would let the first thread keep count of how many threads are running or were started > the number of simultaneous threads which can run at the same time is called throttling
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 166
FMX enumerated colours 2 117
Reconfigure Delphi Install? 2 61
Dynamically Created Query 3 62
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question