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

    Problems about multi-thread synchronization

    Hi:

    my way to synchronize is:

    g_iThreads

    BOOL threadproc(...)
    {

    g_iThreads--;
    return true;
    }
    but if the application exit between g_iThreads--and return true.It may cause memory leak.isn't it?

    It seems that to use WaitForMultipleObjects will be well.but I don't know that if there is an NULL in the HANDLE array of threads will it work as well.For example:the element 1 and 3 of the array is valid,and 2 is NULL.

  2. #2
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882
    If application exits ,then all allocated memory is deleted automatically ... Memory leak is when you looses referance to allocated memory.
    Regards,
    Ramkrishna Pawar

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