CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2009
    Posts
    15

    Post Thread programming

    I have a function A which is running under main thread.Function A calling function B.In function B we are creating a thread,i want to still in function till the thread execute. because B need to retun a result value to A.How do i do it,sleep() and join() both i can't use because i need all to be executed.

  2. #2
    Join Date
    Jul 2006
    Posts
    297

    Re: Thread programming

    If you want to block a function until a thread is complete then don't use the thread to begin with.

    If you really need the thread because you don't want to hold up the rest of the process and you still need the return value when the thread is complete then you need to use a custom event.

    Honestly though it sounds like you either need to redesign your code so it doesn't need to return a value, or you need to get rid of the thread.

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

Featured