|
-
May 21st, 2004, 01:46 PM
#1
Thread Starter
Addicted Member
parameter in thread, this is a real thread??
in this code:
VB Code:
'make delegate with same signature
Public Delegate Sub DoOperationHandler(param1 as integer,param2 as integer)
'with params
Private Sub DoOperation(param1 as integer,param2 as integer)
Result=param1+param2
'Do your stuff...
End Sub
'you don't need this sub to fire the threaded method
Private Sub eheheheh()
Dim x As New DoOperationHandler(AddressOf DoOperation)
x.BeginInvoke(1,4,Nothing,Nothing)
End Sub
this launch a real thread?? how can a I interrupt, resume, abort and etc???
Thnak you,
Guilherme Costa
-
May 21st, 2004, 02:33 PM
#2
no thats not a real " Thread " ( eg: seperate thread to the one you call it from )
since you can't use the AddressOf call in the same way in .NET as you could in vb6 , you sometimes need to create a Delegate which invokes the call you wish to make.
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
May 21st, 2004, 09:31 PM
#3
BeginInvoke runs it on another thread or Asynchronously but there is no way (that I know of) to get a thread object from it and you need a thread object to have that functionality. If you call EndInvoke it will work the same as Join on a thread. You can also check and do certain things with it through the IAsyncResult object that it returns.
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
|