<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic child thread blocking parent in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/child-thread-blocking-parent/m-p/3008551#M718659</link>
    <description>I am trying to write a simple multithreaded sockets server.&lt;BR /&gt;pthread_create returns 0 and creates and excutes the child thread ok.&lt;BR /&gt;Whilst the child thread is executing though , itseems to block the parent thread from continuing (which I don't think it should do) and from accepting a further connection.&lt;BR /&gt;Only when the child thread has finished executing , is the parent able to continue executing and accept another connection.&lt;BR /&gt;&lt;BR /&gt;I am compiling : cc -Ae -D_POSIX_C_SOURCE=199506L -o stst.exe stst.c -lpthread on an HP=UX 11i&lt;BR /&gt;&lt;BR /&gt;Any advice on how to prevent the child thread from blocking the parent would be appreciated.&lt;BR /&gt;&lt;BR /&gt;Julian&lt;BR /&gt;</description>
    <pubDate>Thu, 26 Jun 2003 11:37:28 GMT</pubDate>
    <dc:creator>Julian Lurie</dc:creator>
    <dc:date>2003-06-26T11:37:28Z</dc:date>
    <item>
      <title>child thread blocking parent</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/child-thread-blocking-parent/m-p/3008551#M718659</link>
      <description>I am trying to write a simple multithreaded sockets server.&lt;BR /&gt;pthread_create returns 0 and creates and excutes the child thread ok.&lt;BR /&gt;Whilst the child thread is executing though , itseems to block the parent thread from continuing (which I don't think it should do) and from accepting a further connection.&lt;BR /&gt;Only when the child thread has finished executing , is the parent able to continue executing and accept another connection.&lt;BR /&gt;&lt;BR /&gt;I am compiling : cc -Ae -D_POSIX_C_SOURCE=199506L -o stst.exe stst.c -lpthread on an HP=UX 11i&lt;BR /&gt;&lt;BR /&gt;Any advice on how to prevent the child thread from blocking the parent would be appreciated.&lt;BR /&gt;&lt;BR /&gt;Julian&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Jun 2003 11:37:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/child-thread-blocking-parent/m-p/3008551#M718659</guid>
      <dc:creator>Julian Lurie</dc:creator>
      <dc:date>2003-06-26T11:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: child thread blocking parent</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/child-thread-blocking-parent/m-p/3008552#M718660</link>
      <description>Hi,&lt;BR /&gt;It is normal !!! In your code, you do a pthread_create, and then a pthread_join. Take a look in man page, this function wait for the completion of the thread !! So you primary thread launch a thread, and wait that this thread has finished. Why do you put this pthread_join at this stage ? It should be somewhere else to wait the end of each thread, not in your launching function.&lt;BR /&gt;&lt;BR /&gt;Cheers.</description>
      <pubDate>Thu, 26 Jun 2003 11:45:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/child-thread-blocking-parent/m-p/3008552#M718660</guid>
      <dc:creator>Bruno Vidal</dc:creator>
      <dc:date>2003-06-26T11:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: child thread blocking parent</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/child-thread-blocking-parent/m-p/3008553#M718661</link>
      <description>Julian,&lt;BR /&gt;   pthread_join() will wait for the thread it created.  It is blocking and waiting for the thread to be finished. So, whatever you are experiencing is correct. &lt;BR /&gt;&lt;BR /&gt;   You are also calling pthread_detach().  This you have to do after creating the thread.  Then write the code for the parent thread.  Call pthread_join() at the end of the show to let the child thread join parent thread.&lt;BR /&gt;&lt;BR /&gt;  Read the man pages of pthread_join, pthread_create and pthread_detach for more info.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Umapathy</description>
      <pubDate>Thu, 26 Jun 2003 11:54:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/child-thread-blocking-parent/m-p/3008553#M718661</guid>
      <dc:creator>Umapathy S</dc:creator>
      <dc:date>2003-06-26T11:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: child thread blocking parent</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/child-thread-blocking-parent/m-p/3008554#M718662</link>
      <description>Julian,&lt;BR /&gt;   The fix will be like this.  &lt;BR /&gt;&lt;BR /&gt;   Whenever you are creating the thread, store the thread_handle in a datastructure.  When the socket server goes down, go in a loop for the number of threads created so far and call  pthread_join() with those thread handles to wait for the threads one by one.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Umapathy&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Jun 2003 12:02:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/child-thread-blocking-parent/m-p/3008554#M718662</guid>
      <dc:creator>Umapathy S</dc:creator>
      <dc:date>2003-06-26T12:02:39Z</dc:date>
    </item>
  </channel>
</rss>

