<?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 Re: Shared libraries, threads and gethostbyname in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888700#M719535</link>
    <description>I guess the forum doesn't like .tar.gz as an extension?  Maybe this one will work.  Thanks!</description>
    <pubDate>Wed, 29 Jan 2003 17:55:08 GMT</pubDate>
    <dc:creator>Stanley Lewis_1</dc:creator>
    <dc:date>2003-01-29T17:55:08Z</dc:date>
    <item>
      <title>Shared libraries, threads and gethostbyname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888695#M719530</link>
      <description>Hi!&lt;BR /&gt;&lt;BR /&gt;I'm trying to figure out why this code:&lt;BR /&gt;&lt;BR /&gt;--------------------------------------&lt;BR /&gt;#include &lt;NETDB.H&gt;&lt;BR /&gt;#include &lt;PTHREAD.H&gt;&lt;BR /&gt;#include &lt;ERRNO.H&gt;&lt;BR /&gt;&lt;BR /&gt;extern "C"&lt;BR /&gt;{&lt;BR /&gt;     void* test_thr(void* args)&lt;BR /&gt;     {&lt;BR /&gt;          cout &amp;lt;&amp;lt; "-------------------------------" &amp;lt;&amp;lt; endl;&lt;BR /&gt;          cout &amp;lt;&amp;lt; "Calling gethostbyname()" &amp;lt;&amp;lt; endl;&lt;BR /&gt;          hostent* host = gethostbyname("localhost");  &lt;BR /&gt;          cout &amp;lt;&amp;lt; "host address is: " &amp;lt;&amp;lt; host-&amp;gt;h_name &amp;lt;&amp;lt; endl;   &lt;BR /&gt;          cout &amp;lt;&amp;lt; "errno is: " &amp;lt;&amp;lt; errno &amp;lt;&amp;lt; endl;&lt;BR /&gt;          cout &amp;lt;&amp;lt; "-------------------------------" &amp;lt;&amp;lt; endl;     &lt;BR /&gt;     }   &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int do_test( void )&lt;BR /&gt;{&lt;BR /&gt;     pthread_t tid;&lt;BR /&gt;     pthread_create(&amp;amp;tid, NULL, test_thr, NULL);&lt;BR /&gt;     pthread_join(tid, NULL);&lt;BR /&gt;}&lt;BR /&gt;--------------------------------------&lt;BR /&gt;&lt;BR /&gt;Blocks on the gethostbyname() call when the above is put into a shared library and do_test() is called.  Is there anything inherantly wrong with calling hostname lookup API's from the context of a thread created from a shared library that's been loaded into the main executable via shl_load()?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;/ERRNO.H&gt;&lt;/PTHREAD.H&gt;&lt;/NETDB.H&gt;</description>
      <pubDate>Wed, 22 Jan 2003 22:15:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888695#M719530</guid>
      <dc:creator>Stanley Lewis_1</dc:creator>
      <dc:date>2003-01-22T22:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: Shared libraries, threads and gethostbyname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888696#M719531</link>
      <description>It works fine for me in this small test program.  Note that pthread should be the first system header included.  All the files in the program and shared library should be compiled with aCC -mt or equivalent defines for threadsafe.</description>
      <pubDate>Tue, 28 Jan 2003 21:33:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888696#M719531</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2003-01-28T21:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Shared libraries, threads and gethostbyname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888697#M719532</link>
      <description>Hmmm...  That does work better.&lt;BR /&gt;&lt;BR /&gt;I can't tell, but I think my application is getting into a situation like the attached archive.  In this case, I've got a global object that in turns makes the "do_test()" call.  In this case the gethostbyname() call blocks...</description>
      <pubDate>Tue, 28 Jan 2003 22:15:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888697#M719532</guid>
      <dc:creator>Stanley Lewis_1</dc:creator>
      <dc:date>2003-01-28T22:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Shared libraries, threads and gethostbyname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888698#M719533</link>
      <description>BTW thanks for the code!</description>
      <pubDate>Tue, 28 Jan 2003 22:16:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888698#M719533</guid>
      <dc:creator>Stanley Lewis_1</dc:creator>
      <dc:date>2003-01-28T22:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Shared libraries, threads and gethostbyname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888699#M719534</link>
      <description>That attachment is not readable.</description>
      <pubDate>Wed, 29 Jan 2003 17:51:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888699#M719534</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2003-01-29T17:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Shared libraries, threads and gethostbyname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888700#M719535</link>
      <description>I guess the forum doesn't like .tar.gz as an extension?  Maybe this one will work.  Thanks!</description>
      <pubDate>Wed, 29 Jan 2003 17:55:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-threads-and-gethostbyname/m-p/2888700#M719535</guid>
      <dc:creator>Stanley Lewis_1</dc:creator>
      <dc:date>2003-01-29T17:55:08Z</dc:date>
    </item>
  </channel>
</rss>

