Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Howto to execute a function in a separate thread

Status
Not open for further replies.

mibosoft

Programmer
Jul 23, 2002
106
SE
Hi,
My app has built-in FTP functionaly available as a procedure in a .prg file. I would like to execute this procedure without having to wait for it to finalize like "do ftp nowait". Is there a way to achieve this.

I thought of putting it in own .dll but then (apparently) I can't use dialogs and putting it in an own .exe probably gets slow (.exe startup).

/Micael
 

Andy,

I accept all of that. But it's separate from the question of synchronicity.

If a VFP app fires a VFP COM EXE, I agree you'll see them both in task manager. My point was that the first app will suspend until the second one finishes. At least, that's what I always assumed. I've never done any testing on this.

Can you clarify that?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike Lewis said:
I accept all of that. But it's separate from the question of synchronicity.
Ah, I see.

The answer is they are synchronous. If you call a method in a COM exe the calling program will wait until the method completes.

There are ways around this though where you can utilize the benefit of multiple processes and get better performance from your app.

Andy
 
One of two things I want to avoid is that if FTP hangs, the whole app shouldn't and that seems to be solved in a COM exe as the process can be killed in the task manager (can this be done even programatically?).

"There are ways around this though where you can utilize the benefit of multiple processes and get better performance from your app."

That would solve issue number two. Is this a complicated story or are there examples available?

/Micael
 

Andy,

The answer is they are synchronous. If you call a method in a COM exe the calling program will wait until the method completes.

That confirms my understanding (and also what I told a client recently).

Thanks for the clarification.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
normanbates said:
Is this a complicated story or are there examples available?
No specific examples that I know about. I wrote a COM exe at one time where my calling app would send my COM exe a job (logging events to text and data files) and then continue on it's way. The COM exe simply stuffed the job in a buffer (array) and then returned control back to the calling app immediately. There was a timer in the COM exe that fired that then checked the buffer for something to do... and then did it.

This way I took all the logging overhead out of my main app and let a COM exe do it for me in a separate process.

Hope this helps.

Andy
 
Andy,
Sounds like a good solution. I will make some tests soon.

Thanks for your help,
Micael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top