~ubuntu-branches/ubuntu/intrepid/curl/intrepid

« back to all changes in this revision

Viewing changes to lib/hostthre.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-10-30 10:56:48 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061030105648-uo8q8w9xklb40b4k
Tags: 7.15.5-1ubuntu1
* Merge from debian unstable. Remaining Ubuntu changes:
  - debian/control: Drop libdb4.2 build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: hostthre.c,v 1.36 2006-04-26 17:23:28 giva Exp $
 
21
 * $Id: hostthre.c,v 1.42 2006-07-25 13:49:50 yangtse Exp $
22
22
 ***************************************************************************/
23
23
 
24
24
#include "setup.h"
26
26
#include <string.h>
27
27
#include <errno.h>
28
28
 
29
 
#ifdef HAVE_MALLOC_H
 
29
#ifdef NEED_MALLOC_H
30
30
#include <malloc.h>
31
31
#endif
32
32
#ifdef HAVE_SYS_TYPES_H
157
157
  unsigned thread_id;
158
158
  DWORD  thread_status;
159
159
  curl_socket_t dummy_sock;   /* dummy for Curl_resolv_fdset() */
160
 
  FILE *stderr_file;
161
160
  HANDLE mutex_waiting;  /* marks that we are still waiting for a resolve */
162
161
  HANDLE event_resolved; /* marks that the thread obtained the information */
163
162
  HANDLE event_thread_started; /* marks that the thread has initialized and
302
301
    return (unsigned)-1;
303
302
  }
304
303
 
305
 
  /* Sharing the same _iob[] element with our parent thread should
306
 
   * hopefully make printouts synchronised. I'm not sure it works
307
 
   * with a static runtime lib (MSVC's libc.lib).
308
 
   */
309
 
#ifndef _WIN32_WCE
310
 
  *stderr = *td->stderr_file;
311
 
#endif
312
 
 
313
304
  WSASetLastError (conn->async.status = NO_DATA); /* pending status */
314
305
 
315
306
  /* Signaling that we have initialized all copies of data and handles we
369
360
    return -1;
370
361
  }
371
362
 
372
 
#ifndef _WIN32_WCE
373
 
  *stderr = *td->stderr_file;
374
 
#endif
375
 
 
376
363
  itoa(conn->async.port, service, 10);
377
364
 
378
365
  WSASetLastError(conn->async.status = NO_DATA); /* pending status */
538
525
    return FALSE;
539
526
  }
540
527
 
541
 
  td->stderr_file = stderr;
542
 
 
543
528
#ifdef _WIN32_WCE
544
529
  td->thread_hnd = (HANDLE) CreateThread(NULL, 0,
545
530
                                         (LPTHREAD_START_ROUTINE) THREAD_FUNC,
557
542
#endif
558
543
 
559
544
  if (!td->thread_hnd) {
 
545
#ifdef _WIN32_WCE
 
546
     TRACE(("CreateThread() failed; %s\n", Curl_strerror(conn,GetLastError())));
 
547
#else
560
548
     SetLastError(errno);
561
549
     TRACE(("_beginthreadex() failed; %s\n", Curl_strerror(conn,errno)));
 
550
#endif
562
551
     Curl_destroy_thread_data(&conn->async);
563
552
     return FALSE;
564
553
  }
737
726
 * Curl_getaddrinfo() - for Windows threading without ENABLE_IPV6.
738
727
 */
739
728
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
740
 
                                char *hostname,
 
729
                                const char *hostname,
741
730
                                int port,
742
731
                                int *waitp)
743
732
{
777
766
 * Curl_getaddrinfo() - for Windows threading IPv6 enabled
778
767
 */
779
768
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
780
 
                                char *hostname,
 
769
                                const char *hostname,
781
770
                                int port,
782
771
                                int *waitp)
783
772
{