Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How does Calvin's code work?
Message
From
26/02/2004 16:59:58
 
 
To
26/02/2004 13:16:49
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00880866
Message ID:
00881273
Views:
78
>Hi Al,
>
>>
>>I was also wondering how this callback technique would work for "asynchronous" processing. If I have this scenario:
>>
>>- a Main (client) program instantiates 2 COM servers. Server A does some scanning of files on local drive C:, Server B does some scanning of files on network drive F:. Each may take several minutes to process but are likely to cause low CPU utilization.
>>
>>- in the meantime, the main program may be doing some CPU-intensive activity.
>>
>>What happens when Servers A and B "call back" that they've finished their tasks, but the main program is running something else (worst-case scenario, say a large SELECT - SQL)? Do the callbacks fail? Does COM somehow queue the callbacks to be processed the next time the client is available to do so? TIA.
>>
>
>Are you saying that Server A and Server B are multi-threaded servers? If not, VFP will wait for ServerA.ScanFiles() to complete before moving on to the next instruction.

I'm just starting to investigate COM in detail. At this point it looks to me like COM is basically synchronous and it's likely to take some work to make it work "asynchronously".
* MAIN.PRG
loServerA = CREATEOBJECT("MyServer.DriveScanner")
loServerB = CREATEOBJECT("MyServer.DriveScanner")

loServerA.StartScan("C")

* I believe you are correct, the following method call
* won't start until the previous one finishes i.e. it's synchronous
loServerB.StartScan("F")
In fact, in this scenario I don't think it will make a difference if MyServer.DriveScanner is a MTDLL or not. My understanding is that a MTDLL server simply allows multiple clients to simultaneously make calls to it; if the processing time varies in length overall performance can improve because short calls are not blocked by long ones. But in either case, the calling client (MAIN.PRG) would wait until the server method call completed. In this case we have a single client to any one COM server so, as I understand it, an MTDLL server would not have any benefit.

Or, were you talking about using a MTDLL something like this:
* MAIN.PRG
loServerA = CREATEOBJECT("MyServer.DriveScanner") && MTDLL server
loServerA.StartScan("C")

* Since we still have the same client MAIN.PRG, my suspicion
* is that the following call still won't start until the one above finishes:
loServerA.StartScan("F")
>Or do you mean do something like ServerA.StartScan(), then the server somehow returns control to the calling program while running the scan in the background? I don't know how to do that, but I would be interested in the answer to your question.

That's what I'm after - asynchronous behaviour, similar to an async SPT call to a DB backend.

>COM+ Queued Components might be another option.

Do you have any good URLs for an overview of this? Do you know if it's supported down to W98 (and preferably, W95)?
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform