2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* GLIB - Library of useful routines for C programming
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * gthread.c: solaris thread system implementation
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Copyright 1998-2001 Sebastian Wilhelmi; University of Karlsruhe
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Copyright 2001 Hans Breuer
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * This library is free software; you can redistribute it and/or
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * modify it under the terms of the GNU Lesser General Public
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * License as published by the Free Software Foundation; either
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * version 2 of the License, or (at your option) any later version.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * This library is distributed in the hope that it will be useful,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * but WITHOUT ANY WARRANTY; without even the implied warranty of
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Lesser General Public License for more details.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * You should have received a copy of the GNU Lesser General Public
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * License along with this library; if not, write to the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Boston, MA 02111-1307, USA.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * file for a list of people on the GLib Team.  See the ChangeLog
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * files for a list of changes.  These files are distributed with
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * GLib at ftp://ftp.gtk.org/pub/gtk/.
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/*
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * MT safe
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-09 23:07:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "config.h"
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-09 23:07:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "glib.h"
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define STRICT
							 | 
						
					
						
							
								
									
										
										
										
											2006-03-11 20:43:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#define _WIN32_WINDOWS 0x0401 /* to get IsDebuggerPresent */
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <windows.h>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#undef STRICT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <process.h>
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <stdlib.h>
							 | 
						
					
						
							
								
									
										
										
										
											2006-03-02 12:05:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <stdio.h>
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define win32_check_for_error(what) G_STMT_START{			\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!(what))								\
							 | 
						
					
						
							
								
									
										
										
										
											2001-06-07 10:34:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    g_error ("file %s: line %d (%s): error %s during %s",		\
							 | 
						
					
						
							
								
									
										
										
										
											2008-02-17 12:49:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									     __FILE__, __LINE__, G_STRFUNC,				\
							 | 
						
					
						
							
								
									
										
										
										
											2001-06-07 10:34:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									     g_win32_error_message (GetLastError ()), #what);		\
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }G_STMT_END
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#define G_MUTEX_SIZE (sizeof (gpointer))
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define PRIORITY_LOW_VALUE    THREAD_PRIORITY_BELOW_NORMAL
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define PRIORITY_NORMAL_VALUE THREAD_PRIORITY_NORMAL
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define PRIORITY_HIGH_VALUE   THREAD_PRIORITY_ABOVE_NORMAL
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define PRIORITY_URGENT_VALUE THREAD_PRIORITY_HIGHEST
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static DWORD g_thread_self_tls;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static DWORD g_private_tls;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static DWORD g_cond_event_tls;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static CRITICAL_SECTION g_thread_global_spinlock;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								typedef BOOL (__stdcall *GTryEnterCriticalSectionFunc) (CRITICAL_SECTION *);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static GTryEnterCriticalSectionFunc try_enter_critical_section = NULL;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* As noted in the docs, GPrivate is a limited resource, here we take
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * a rather low maximum to save memory, use GStaticPrivate instead. */
							 | 
						
					
						
							
								
									
										
										
										
											2006-03-02 12:05:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#define G_PRIVATE_MAX 100
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static GDestroyNotify g_private_destructors[G_PRIVATE_MAX];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static guint g_private_next = 0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/* A "forward" declaration of this structure */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static GThreadFunctions g_thread_functions_for_glib_use_default;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								typedef struct _GThreadData GThreadData;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								struct _GThreadData
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  GThreadFunc func;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gpointer data;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  HANDLE thread;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gboolean joinable;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								struct _GCond
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  GPtrArray *array;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRITICAL_SECTION lock;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static GMutex *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_mutex_new_win32_cs_impl (void)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRITICAL_SECTION *cs = g_new (CRITICAL_SECTION, 1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gpointer *retval = g_new (gpointer, 1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  InitializeCriticalSection (cs);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  *retval = cs;
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return (GMutex *) retval;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_mutex_free_win32_cs_impl (GMutex *mutex)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gpointer *ptr = (gpointer *) mutex;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRITICAL_SECTION *cs = (CRITICAL_SECTION *) *ptr;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  DeleteCriticalSection (cs);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_free (cs);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_free (mutex);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* NOTE: the functions g_mutex_lock and g_mutex_unlock may not use
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   functions from gmem.c and gmessages.c; */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_mutex_lock_win32_cs_impl (GMutex *mutex)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  EnterCriticalSection (*(CRITICAL_SECTION **)mutex);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static gboolean
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_mutex_trylock_win32_cs_impl (GMutex * mutex)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return try_enter_critical_section (*(CRITICAL_SECTION **)mutex);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_mutex_unlock_win32_cs_impl (GMutex *mutex)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  LeaveCriticalSection (*(CRITICAL_SECTION **)mutex);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static GMutex *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_mutex_new_win32_impl (void)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  HANDLE handle;
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  HANDLE *retval;
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  win32_check_for_error (handle = CreateMutex (NULL, FALSE, NULL));
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  retval = g_new (HANDLE, 1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  *retval = handle;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return (GMutex *) retval;
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_mutex_free_win32_impl (GMutex *mutex)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  win32_check_for_error (CloseHandle (*(HANDLE *) mutex));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_free (mutex);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* NOTE: the functions g_mutex_lock and g_mutex_unlock may not use
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   functions from gmem.c and gmessages.c; */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_mutex_lock_win32_impl (GMutex *mutex)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  WaitForSingleObject (*(HANDLE *) mutex, INFINITE);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static gboolean
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_mutex_trylock_win32_impl (GMutex * mutex)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  DWORD result;
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  win32_check_for_error (WAIT_FAILED !=
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											 (result = WaitForSingleObject (*(HANDLE *)mutex, 0)));
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return result != WAIT_TIMEOUT;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_mutex_unlock_win32_impl (GMutex *mutex)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ReleaseMutex (*(HANDLE *) mutex);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static GCond *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_cond_new_win32_impl (void)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  GCond *retval = g_new (GCond, 1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  retval->array = g_ptr_array_new ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  InitializeCriticalSection (&retval->lock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return retval;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_cond_signal_win32_impl (GCond * cond)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  EnterCriticalSection (&cond->lock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (cond->array->len > 0)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      SetEvent (g_ptr_array_index (cond->array, 0));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      g_ptr_array_remove_index (cond->array, 0);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  LeaveCriticalSection (&cond->lock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_cond_broadcast_win32_impl (GCond * cond)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  guint i;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  EnterCriticalSection (&cond->lock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  for (i = 0; i < cond->array->len; i++)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    SetEvent (g_ptr_array_index (cond->array, i));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_ptr_array_set_size (cond->array, 0);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  LeaveCriticalSection (&cond->lock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static gboolean
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_cond_wait_internal (GCond *cond,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      GMutex *entered_mutex,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      gulong milliseconds)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gulong retval;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  HANDLE event = TlsGetValue (g_cond_event_tls);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!event)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      win32_check_for_error (event = CreateEvent (0, FALSE, FALSE, NULL));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      TlsSetValue (g_cond_event_tls, event);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  EnterCriticalSection (&cond->lock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  /* The event must not be signaled. Check this */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_assert (WaitForSingleObject (event, 0) == WAIT_TIMEOUT);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_ptr_array_add (cond->array, event);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  LeaveCriticalSection (&cond->lock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  g_thread_functions_for_glib_use_default.mutex_unlock (entered_mutex);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  win32_check_for_error (WAIT_FAILED !=
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											 (retval = WaitForSingleObject (event, milliseconds)));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  g_thread_functions_for_glib_use_default.mutex_lock (entered_mutex);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (retval == WAIT_TIMEOUT)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      EnterCriticalSection (&cond->lock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      g_ptr_array_remove (cond->array, event);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      /* In the meantime we could have been signaled, so we must again
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 14:20:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       * wait for the signal, this time with no timeout, to reset
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       * it. retval is set again to honour the late arrival of the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       * signal */
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      win32_check_for_error (WAIT_FAILED !=
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 14:20:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											     (retval = WaitForSingleObject (event, 0)));
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      LeaveCriticalSection (&cond->lock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#ifndef G_DISABLE_ASSERT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  EnterCriticalSection (&cond->lock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  /* Now event must not be inside the array, check this */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_assert (g_ptr_array_remove (cond->array, event) == FALSE);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  LeaveCriticalSection (&cond->lock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif /* !G_DISABLE_ASSERT */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return retval != WAIT_TIMEOUT;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_cond_wait_win32_impl (GCond *cond,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											GMutex *entered_mutex)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_return_if_fail (cond != NULL);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_return_if_fail (entered_mutex != NULL);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_cond_wait_internal (cond, entered_mutex, INFINITE);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static gboolean
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								g_cond_timed_wait_win32_impl (GCond *cond,
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											      GMutex *entered_mutex,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											      GTimeVal *abs_time)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  GTimeVal current_time;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gulong to_wait;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_return_val_if_fail (cond != NULL, FALSE);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_return_val_if_fail (entered_mutex != NULL, FALSE);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2002-11-25 23:08:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!abs_time)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    to_wait = INFINITE;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      g_get_current_time (¤t_time);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (abs_time->tv_sec < current_time.tv_sec ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  (abs_time->tv_sec == current_time.tv_sec &&
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									   abs_time->tv_usec <= current_time.tv_usec))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									to_wait = 0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									to_wait = (abs_time->tv_sec - current_time.tv_sec) * 1000 +
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									  (abs_time->tv_usec - current_time.tv_usec) / 1000;
							 | 
						
					
						
							
								
									
										
										
										
											2002-11-25 23:08:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return g_cond_wait_internal (cond, entered_mutex, to_wait);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_cond_free_win32_impl (GCond * cond)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  DeleteCriticalSection (&cond->lock);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_ptr_array_free (cond->array, TRUE);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_free (cond);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static GPrivate *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_private_new_win32_impl (GDestroyNotify destructor)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  GPrivate *result;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  EnterCriticalSection (&g_thread_global_spinlock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (g_private_next >= G_PRIVATE_MAX)
							 | 
						
					
						
							
								
									
										
										
										
											2006-03-02 12:05:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      char buf[100];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      sprintf (buf,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									       "Too many GPrivate allocated. Their number is limited to %d.",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									       G_PRIVATE_MAX);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      MessageBox (NULL, buf, NULL, MB_ICONERROR|MB_SETFOREGROUND);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (IsDebuggerPresent ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									G_BREAKPOINT ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      abort ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_private_destructors[g_private_next] = destructor;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  result = GUINT_TO_POINTER (g_private_next);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_private_next++;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  LeaveCriticalSection (&g_thread_global_spinlock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return result;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* NOTE: the functions g_private_get and g_private_set may not use
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   functions from gmem.c and gmessages.c */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_private_set_win32_impl (GPrivate * private_key, gpointer value)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gpointer* array = TlsGetValue (g_private_tls);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  guint index = GPOINTER_TO_UINT (private_key);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (index >= G_PRIVATE_MAX)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!array)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      array = (gpointer*) calloc (G_PRIVATE_MAX, sizeof (gpointer));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      TlsSetValue (g_private_tls, array);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  array[index] = value;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static gpointer
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_private_get_win32_impl (GPrivate * private_key)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gpointer* array = TlsGetValue (g_private_tls);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  guint index = GPOINTER_TO_UINT (private_key);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (index >= G_PRIVATE_MAX || !array)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return NULL;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return array[index];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_thread_set_priority_win32_impl (gpointer thread, GThreadPriority priority)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  GThreadData *target = *(GThreadData **)thread;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_return_if_fail (priority >= G_THREAD_PRIORITY_LOW);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_return_if_fail (priority <= G_THREAD_PRIORITY_URGENT);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  win32_check_for_error (SetThreadPriority (target->thread,
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													    g_thread_priority_map [priority]));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_thread_self_win32_impl (gpointer thread)
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  GThreadData *self = TlsGetValue (g_thread_self_tls);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!self)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      /* This should only happen for the main thread! */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      HANDLE handle = GetCurrentThread ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      HANDLE process = GetCurrentProcess ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      self = g_new (GThreadData, 1);
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      win32_check_for_error (DuplicateHandle (process, handle, process,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													      &self->thread, 0, FALSE,
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													      DUPLICATE_SAME_ACCESS));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      win32_check_for_error (TlsSetValue (g_thread_self_tls, self));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      self->func = NULL;
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      self->data = NULL;
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      self->joinable = FALSE;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  *(GThreadData **)thread = self;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_thread_exit_win32_impl (void)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  GThreadData *self = TlsGetValue (g_thread_self_tls);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  guint i, private_max;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  gpointer *array = TlsGetValue (g_private_tls);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  HANDLE event = TlsGetValue (g_cond_event_tls);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  EnterCriticalSection (&g_thread_global_spinlock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  private_max = g_private_next;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  LeaveCriticalSection (&g_thread_global_spinlock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (array)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2006-02-20 02:47:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      gboolean some_data_non_null;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      do {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									some_data_non_null = FALSE;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									for (i = 0; i < private_max; i++)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    GDestroyNotify destructor = g_private_destructors[i];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    GDestroyNotify data = array[i];
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-02-20 02:47:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									    if (data)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									      some_data_non_null = TRUE;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    array[i] = NULL;
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-02-20 02:47:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									    if (destructor && data)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									      destructor (data);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      } while (some_data_non_null);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-03 14:53:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      free (array);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      win32_check_for_error (TlsSetValue (g_private_tls, NULL));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (self)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (!self->joinable)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  win32_check_for_error (CloseHandle (self->thread));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  g_free (self);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      win32_check_for_error (TlsSetValue (g_thread_self_tls, NULL));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (event)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      CloseHandle (event);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      win32_check_for_error (TlsSetValue (g_cond_event_tls, NULL));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  _endthreadex (0);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static guint __stdcall
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_thread_proxy (gpointer data)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  GThreadData *self = (GThreadData*) data;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  win32_check_for_error (TlsSetValue (g_thread_self_tls, self));
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  self->func (self->data);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_thread_exit_win32_impl ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_assert_not_reached ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return 0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								g_thread_create_win32_impl (GThreadFunc func,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											    gpointer data,
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											    gulong stack_size,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											    gboolean joinable,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											    gboolean bound,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											    GThreadPriority priority,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											    gpointer thread,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											    GError **error)
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  guint ignore;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  GThreadData *retval;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_return_if_fail (func);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_return_if_fail (priority >= G_THREAD_PRIORITY_LOW);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_return_if_fail (priority <= G_THREAD_PRIORITY_URGENT);
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  retval = g_new(GThreadData, 1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  retval->func = func;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  retval->data = data;
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  retval->joinable = joinable;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  retval->thread = (HANDLE) _beginthreadex (NULL, stack_size, g_thread_proxy,
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													    retval, 0, &ignore);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (retval->thread == NULL)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2001-06-07 10:34:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      gchar *win_error = g_win32_error_message (GetLastError ());
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      g_set_error (error, G_THREAD_ERROR, G_THREAD_ERROR_AGAIN,
							 | 
						
					
						
							
								
									
										
										
										
											2001-06-07 10:34:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                   "Error creating thread: %s", win_error);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      g_free (retval);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      g_free (win_error);
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  *(GThreadData **)thread = retval;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_thread_set_priority_win32_impl (thread, priority);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_thread_yield_win32_impl (void)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Sleep(0);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_thread_join_win32_impl (gpointer thread)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  GThreadData *target = *(GThreadData **)thread;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_return_if_fail (target->joinable);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  win32_check_for_error (WAIT_FAILED !=
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											 WaitForSingleObject (target->thread, INFINITE));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  win32_check_for_error (CloseHandle (target->thread));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_free (target);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-01-08 05:13:15 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								static guint64
							 | 
						
					
						
							
								
									
										
										
										
											2007-01-16 21:25:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								g_thread_gettime_impl (void)
							 | 
						
					
						
							
								
									
										
										
										
											2007-01-08 05:13:15 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  guint64 v;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-01-16 13:57:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  /* Returns 100s of nanoseconds since start of 1601 */
							 | 
						
					
						
							
								
									
										
										
										
											2007-01-08 05:13:15 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  GetSystemTimeAsFileTime ((FILETIME *)&v);
							 | 
						
					
						
							
								
									
										
										
										
											2007-01-16 13:57:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  /* Offset to Unix epoch */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  v -= G_GINT64_CONSTANT (116444736000000000);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  /* Convert to nanoseconds */
							 | 
						
					
						
							
								
									
										
										
										
											2007-01-16 10:45:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  v *= 100;
							 | 
						
					
						
							
								
									
										
										
										
											2007-01-08 05:13:15 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return v;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static GThreadFunctions g_thread_functions_for_glib_use_default =
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_mutex_new_win32_impl,           /* mutex */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_mutex_lock_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_mutex_trylock_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_mutex_unlock_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_mutex_free_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_cond_new_win32_impl,            /* condition */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_cond_signal_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_cond_broadcast_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_cond_wait_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_cond_timed_wait_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_cond_free_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_private_new_win32_impl,         /* private thread data */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_private_get_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_private_set_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_thread_create_win32_impl,       /* thread */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_thread_yield_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_thread_join_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_thread_exit_win32_impl,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  g_thread_set_priority_win32_impl,
							 | 
						
					
						
							
								
									
										
										
										
											2001-09-19 12:46:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  g_thread_self_win32_impl,
							 | 
						
					
						
							
								
									
										
										
										
											2007-01-16 21:25:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  NULL                             /* no equal function necessary */
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define HAVE_G_THREAD_IMPL_INIT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static void
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								g_thread_impl_init ()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  static gboolean beenhere = FALSE;
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  HMODULE kernel32;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24  Bruno Haible  <haible@clisp.cons.org>
	* glib/gwin32.c (g_win32_getlocale): When the sublangid is
	SUBLANG_DEFAULT, return the locale of the language's main country,
	not a country-neutral locale. E.g. "en_US" instead of "en". Add
	handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED
	(China == CN, CH == Switzerland). Ignore empty environment
	variable values.
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the
	source file from libcharset and compile in this directory.
	* glib/giochannel.c: Mark rest of g_set_error strings for
	translation, too.
	* glib/giowin32.c: Add some debugging output functions, call them
	when debugging.
	(create_events, g_io_win32_msg_write): Free message fetched with
	g_win32_error_message ().
	(g_io_win32_check): Indentation fixes.
	(g_io_win32_fd_read,g_io_win32_sock_read): Don't always return
	G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes,
	like on Unix. This helps making the test programs run
	successfully.
	* glib/gmain.c (g_poll): Return the code ifdeffed out with
	TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things
	seem to work as previously with the code in place. Especially
	spawn-test didn't work with the code ifdeffed out (Bug#61067).
	* glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless
	on Unix.
	* glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000)
	accidentally left in.
gthread:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* gthread-win32.c: Use an extra level of indirection for GMutex.
	It is now a pointer either to a pointer to a CRITICAL_SECTION
	struct, or to a mutex HANDLE. This is needed in case the user
	defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect
	the size of *GMutex, but this used to vary depending on whether we
	at run-time chose to use CRITICAL_SECTIONs or mutexes.
	(g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call
	DeleteCriticalSection() when done with it.
	* gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call
	g_thread_impl_init() before accessing
	g_thread_functions_for_glib_use_default, as the
	g_thread_impl_init() function might modify it.
po:
2001-09-28  Tor Lillqvist  <tml@iki.fi>
	* POTFILES.in: Add iochannel.c and giowin32.c.
	* sv.po: Remove a bogus fuzziness indicator.
											
										 
										
											2001-09-27 22:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (beenhere)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  beenhere = TRUE;
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  win32_check_for_error (TLS_OUT_OF_INDEXES !=
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											 (g_thread_self_tls = TlsAlloc ()));
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  win32_check_for_error (TLS_OUT_OF_INDEXES !=
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											 (g_private_tls = TlsAlloc ()));
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  win32_check_for_error (TLS_OUT_OF_INDEXES !=
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											 (g_cond_event_tls = TlsAlloc ()));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  InitializeCriticalSection (&g_thread_global_spinlock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  /* Here we are looking for TryEnterCriticalSection in KERNEL32.DLL,
							 | 
						
					
						
							
								
									
										
										
										
											2006-12-28 10:48:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   * if it is found, we can use the in general faster critical
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   * sections instead of mutexes. See
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   * http://world.std.com/~jmhart/csmutx.htm for some discussion.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   */
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  kernel32 = GetModuleHandle ("KERNEL32.DLL");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (kernel32)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      try_enter_critical_section = (GTryEnterCriticalSectionFunc)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									GetProcAddress(kernel32, "TryEnterCriticalSection");
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      /* Even if TryEnterCriticalSection is found, it is not
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       * necessarily working..., we have to check it */
							 | 
						
					
						
							
								
									
										
										
										
											2006-05-11 00:08:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if (try_enter_critical_section &&
							 | 
						
					
						
							
								
									
										
										
										
											2001-05-22 12:28:06 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  try_enter_critical_section (&g_thread_global_spinlock))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  LeaveCriticalSection (&g_thread_global_spinlock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  g_thread_functions_for_glib_use_default.mutex_new =
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    g_mutex_new_win32_cs_impl;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  g_thread_functions_for_glib_use_default.mutex_lock =
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    g_mutex_lock_win32_cs_impl;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  g_thread_functions_for_glib_use_default.mutex_trylock =
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    g_mutex_trylock_win32_cs_impl;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  g_thread_functions_for_glib_use_default.mutex_unlock =
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    g_mutex_unlock_win32_cs_impl;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									  g_thread_functions_for_glib_use_default.mutex_free =
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    g_mutex_free_win32_cs_impl;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |