Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2001:
[Freeciv-Dev] Winsock patch
Home

[Freeciv-Dev] Winsock patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Winsock patch
From: Andreas Kemnade <akemnade@xxxxxxxxxxx>
Date: Sun, 11 Feb 2001 13:36:28 +0100 (CET)

Vasco Alexandre Da Silva Costa writes:
 > Here is yet another slightly changed version of Andreas's patch.
 > 
 > After it's tested if it works in Windows (could you please do it Andreas?) 
 > If there's nothing wrong with it and noone objects it will be commited.
 > 
Some modifications are needed:
It is safer to use _beginthreadex instead of CreateThread because some
C-Lib data structs are initialized then but it has a strange prototype,
so some casts are necessary. I have looked into my win32 book for this.

Greetings
Andreas Kemnade

BTW: Is the other SOCKET_ZERO_ISNT_STDIN stuff only used on BeOS?

--- freeciv/common/support.c    Sun Feb 11 13:23:22 2001
+++ freeciv-w2/common/support.c Sun Feb 11 12:54:35 2001
@@ -478,7 +478,7 @@
 static HANDLE          mythread=INVALID_HANDLE_VALUE; 
 
 
-static DWORD WINAPI thread_proc(LPVOID)
+static DWORD WINAPI thread_proc(LPVOID data)
 {
   if (fgets(mybuf, MYBUFSIZE, stdin)) {
     char *s;
@@ -491,13 +491,14 @@
 
 void my_init_console(void)
 {
-  DWORD threadid;
+  unsigned int threadid;
 
   if (mythread!=INVALID_HANDLE_VALUE)
     return;
 
-  buf[0]='\0';
-  mythread=CreateThread(NULL, 0, thread_proc, NULL, 0, &threadid);
+  mybuf[0]='\0';
+  mythread=(HANDLE)_beginthreadex(NULL, 0,thread_proc,
+                         NULL, 0, &threadid);
 }
 
 /* The return of my_read_console() is in a statically allocated buffer.




[Prev in Thread] Current Thread [Next in Thread]