|
-
Apr 19th, 2002, 11:08 PM
#1
Thread Starter
New Member
Does Vb Support Parallel Processing???
WELL, THE TITLE PRETTY MUCH DECLARES MY QUESTION. CAN VB BE USED TO CREATE A PARALLEL PROCESSING ENVIRONMENT ? IF SO, HOW WOULD THIS BE DONE? THANKS.
-
Apr 19th, 2002, 11:16 PM
#2
Member
Hmm I am not sure what parallel processing is, but I am sure it sounds too complicated for VB 1-6, perhaps .NET does
-
Apr 20th, 2002, 08:46 AM
#3
Parallel processing is implemented at the OS level, not normally the application level. VB will run on Mutli-CPU Windows boxes.
-
Apr 21st, 2002, 06:02 AM
#4
Hyperactive Member
If you mean multithreading, then no it can't. Native VB is not thread safe, and although it is possible to create multithreaded apps, its stupidly complex, and requires a deep knowledge of COM and API and Win32 concepts...
However, you can run out-of-process-space ActiveX EXEs. They will run concurrently to whatever else you may be doing.... eg
Code:
Dim WithEvents obj As AxExeObj
Private Sub Form_Load()
Set obj = New AxExeObj
Debug.Print "Before"
AxeExeObj.LongFunction
Debug.Print "After"
End Sub
' in the active x
Private Sub LongFunction()
' wait for one second
Sleep 1000
Debug.Print "Done"
End Sub
Here, you would expect the output to be
because VB processes things concurrently. However, the actual output would be
because VB won't wait for the function call to return before continuing with execution.
-
Apr 23rd, 2002, 02:47 PM
#5
Lively Member
Perhaps I'm misunderstanding, but if your ActiveX component contains a function that is returning a value to VB, musn't it wait before continuing?
Similar to your example:
Code:
if ActiveXFunctionHere Then
debug.print "True"
else
debug.print "False"
End if
I would assume VB has no choice but to wait for the function to be evaluated, otherwise code like the above would always be false...
If so, is there any way to force VB to wait until the function is returned?
- Kronix
"I have not failed. I have merely found 10,000 ways that won't work." - Thomas Edison
-
Apr 30th, 2002, 11:22 AM
#6
Frenzied Member
I'm sure you will correct me if I'm wrong but . . .
True Parallel processing means more than one processor. As the 'main' unit of execution in a Win32 environment is a process as long as you can assign a vb executable to run on different processors then you have parallel processing. The real trick is to synchronise between the two - and Win32 provides a rich set of synchronisation objects that are easily used within VB.
Another problem will be sharing data but a memory mapped file will be sufficient (and is pretty efficient)
-
Apr 30th, 2002, 11:55 AM
#7
If so, is there any way to force VB to wait until the function is returned?
In a situation such as that you would want to implement a CallBack. VB will not "wait" for the function to return but will "listen" for the function in the ActiveX EXE to "callback" with the results of the function.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|