Results 1 to 3 of 3

Thread: parameter in thread, this is a real thread??

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Location
    Porto Alegre, RS
    Posts
    210

    parameter in thread, this is a real thread??

    in this code:

    VB Code:
    1. 'make delegate with same signature
    2. Public Delegate Sub DoOperationHandler(param1 as integer,param2 as integer)
    3.  
    4. 'with params
    5. Private Sub DoOperation(param1 as integer,param2 as integer)
    6.     Result=param1+param2
    7.     'Do your stuff...
    8. End Sub
    9.  
    10. 'you don't need this sub to fire the threaded method
    11. Private Sub eheheheh()
    12.     Dim x As New DoOperationHandler(AddressOf DoOperation)
    13.     x.BeginInvoke(1,4,Nothing,Nothing)
    14. End Sub

    this launch a real thread?? how can a I interrupt, resume, abort and etc???

    Thnak you,
    Guilherme Costa

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    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]

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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
  •  



Click Here to Expand Forum to Full Width