Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: What should I do? Run a task, a service, a thread or soemthing else?



Permlink Replies: 4 - Last Post: Mar 7, 2018 1:03 PM Last Post By: Joshua Pugh
Joshua Pugh

Posts: 37
Registered: 5/24/14
What should I do? Run a task, a service, a thread or soemthing else?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 6, 2018 1:46 PM
I have a Delphi (Tokyo Update 2) application that runs on a PC that acts like a server to a few other PCs. My app also runs (via shortcut pointing to the executable on the 'server') on a few 'workstations.' I would like for my app to check a specific Cloud amount for the presence of certain files once an hour or when the user requests it.

At this point in time, I am having a blank and cannot figure out how to address this issue. Should I schedule a Windows task on the 'server?' Should I run a service of the 'server' or should I simply run the Cloud check from within the app itself (via a thread)?

Is there a preferred method to address this issue? Any suggestions would be greatly appreciated.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: What should I do? Run a task, a service, a thread or soemthing else?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 6, 2018 2:27 PM   in response to: Joshua Pugh in response to: Joshua Pugh
Joshua Pugh wrote:

Is there a preferred method to address this issue? Any suggestions
would be greatly appreciated.

Well, it really comes down to what your actual requirements are. Does
the user need to know what is going on, or even to trigger it? Should
it run unattended in the background? Only when the user GUI app is
running, or even when not running? Only when the user is logged in to
the PC, or even when no user is logged in at all? You need to really
define your requirements before you can then decide which approach to
implement.

--
Remy Lebeau (TeamB)
Joshua Pugh

Posts: 37
Registered: 5/24/14
Re: What should I do? Run a task, a service, a thread or soemthing else?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 6, 2018 2:54 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Well, it really comes down to what your actual requirements are. Does
the user need to know what is going on, or even to trigger it? Should
it run unattended in the background? Only when the user GUI app is
running, or even when not running? Only when the user is logged in to
the PC, or even when no user is logged in at all? You need to really
define your requirements before you can then decide which approach to
implement.

I would say my requirements should be:

- a Cloud check should be run only when the GUI app is running
- the user should be able to trigger a Cloud check
- if not triggered by the user, the Cloud check should run unattended preferably in the background
Chad Hower

Posts: 613
Registered: 3/2/07
Re: What should I do? Run a task, a service, a thread or soemthing else?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 7, 2018 7:01 AM   in response to: Joshua Pugh in response to: Joshua Pugh
On 3/6/2018 6:54 PM, Joshua Pugh wrote:
I would say my requirements should be:

- a Cloud check should be run only when the GUI app is running
- the user should be able to trigger a Cloud check
- if not triggered by the user, the Cloud check should run unattended preferably in the background

1) Make a method that does it and you can call when user requests it.

2) Use a TTimer and call it on when its event fires.

Unless the code blocks for long, you don't even need to thread it. If it
does block for a while, then you only need to thread only the execution
routine.
Joshua Pugh

Posts: 37
Registered: 5/24/14
Re: What should I do? Run a task, a service, a thread or soemthing else?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 7, 2018 1:03 PM   in response to: Chad Hower in response to: Chad Hower
Chad Hower wrote:
1) Make a method that does it and you can call when user requests it.

2) Use a TTimer and call it on when its event fires.

Unless the code blocks for long, you don't even need to thread it. If it
does block for a while, then you only need to thread only the execution
routine.

Thanks. That makes sense.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02