none
OpenMP parallel section in a WinAPI thread RRS feed

Answers

  • Yup, that's the way I read it.  Relying on it is a different matter.  But this has been working this way for a while now, fixing the thread leak is getting harder and harder without breaking old apps.  Although I don't see how it could really break anything.  After the Win32 thread exits, the threads in the team are all just blocked and will never again execute any code until the process exits.
    Hans Passant.
    • Marked as answer by mpoleg Friday, October 17, 2008 12:51 PM
    Friday, October 17, 2008 11:46 AM
    Moderator
  • Sure, each thread reserves one megabyte of virtual memory for its stack.  At 1600 threads, you get really close to the limit of 2 Gigabytes of addressable virtual memory.

    Hans Passant.
    • Marked as answer by mpoleg Monday, October 20, 2008 10:02 AM
    Friday, October 17, 2008 5:15 PM
    Moderator

All replies

  • Yup, that's the way I read it.  Relying on it is a different matter.  But this has been working this way for a while now, fixing the thread leak is getting harder and harder without breaking old apps.  Although I don't see how it could really break anything.  After the Win32 thread exits, the threads in the team are all just blocked and will never again execute any code until the process exits.
    Hans Passant.
    • Marked as answer by mpoleg Friday, October 17, 2008 12:51 PM
    Friday, October 17, 2008 11:46 AM
    Moderator
  • Thank you for your answer.
    I think we will assume this behavior will not change any time soon.

    I am not sure but it seems that our test crashes when around 1600 threads are created in its process.
    The test creates a WinAPI thread (containing a parallel section) in an endless loop with random input values (the next thread is created after the previous has finished).
    Could you, please, say if there could exist some limitation on a process threads number like 1600?
    Friday, October 17, 2008 1:10 PM
  • Sure, each thread reserves one megabyte of virtual memory for its stack.  At 1600 threads, you get really close to the limit of 2 Gigabytes of addressable virtual memory.

    Hans Passant.
    • Marked as answer by mpoleg Monday, October 20, 2008 10:02 AM
    Friday, October 17, 2008 5:15 PM
    Moderator
  •   Thank you very much
    Monday, October 20, 2008 10:02 AM