mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-03 14:42:10 +01:00
Here we must replace getpwuid by getpwuid_r, but as I do not know how for
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gutils.c (g_get_any_init): Here we must replace getpwuid by getpwuid_r, but as I do not know how for now, I just made a FIXME note ;-) * gdate.c (g_date_set_time): localtime --> localtime_r to make it thread safe. * configure.in: We do not need to check for broken solaris mutex intitializer any longer. Provide a macro to show the used thread implementation. Not nice, but this is needed until thread support is completed here inside glib. * gthread/testgthread.c: conditionally compile according to the G_THREADS_IMPL_??? macros. (test_private_func): use rand_r instead of rand to make it thread safe.
This commit is contained in:
parent
9200f44462
commit
81f8d0bb10
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Here we must replace getpwuid by
|
||||||
|
getpwuid_r, but as I do not know how for now, I just made a FIXME
|
||||||
|
note ;-)
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): localtime --> localtime_r to make it
|
||||||
|
thread safe.
|
||||||
|
|
||||||
|
* configure.in: We do not need to check for broken solaris mutex
|
||||||
|
intitializer any longer. Provide a macro to show the used thread
|
||||||
|
implementation. Not nice, but this is needed until thread support
|
||||||
|
is completed here inside glib.
|
||||||
|
|
||||||
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Here we must replace getpwuid by
|
||||||
|
getpwuid_r, but as I do not know how for now, I just made a FIXME
|
||||||
|
note ;-)
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): localtime --> localtime_r to make it
|
||||||
|
thread safe.
|
||||||
|
|
||||||
|
* configure.in: We do not need to check for broken solaris mutex
|
||||||
|
intitializer any longer. Provide a macro to show the used thread
|
||||||
|
implementation. Not nice, but this is needed until thread support
|
||||||
|
is completed here inside glib.
|
||||||
|
|
||||||
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Here we must replace getpwuid by
|
||||||
|
getpwuid_r, but as I do not know how for now, I just made a FIXME
|
||||||
|
note ;-)
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): localtime --> localtime_r to make it
|
||||||
|
thread safe.
|
||||||
|
|
||||||
|
* configure.in: We do not need to check for broken solaris mutex
|
||||||
|
intitializer any longer. Provide a macro to show the used thread
|
||||||
|
implementation. Not nice, but this is needed until thread support
|
||||||
|
is completed here inside glib.
|
||||||
|
|
||||||
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Here we must replace getpwuid by
|
||||||
|
getpwuid_r, but as I do not know how for now, I just made a FIXME
|
||||||
|
note ;-)
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): localtime --> localtime_r to make it
|
||||||
|
thread safe.
|
||||||
|
|
||||||
|
* configure.in: We do not need to check for broken solaris mutex
|
||||||
|
intitializer any longer. Provide a macro to show the used thread
|
||||||
|
implementation. Not nice, but this is needed until thread support
|
||||||
|
is completed here inside glib.
|
||||||
|
|
||||||
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Here we must replace getpwuid by
|
||||||
|
getpwuid_r, but as I do not know how for now, I just made a FIXME
|
||||||
|
note ;-)
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): localtime --> localtime_r to make it
|
||||||
|
thread safe.
|
||||||
|
|
||||||
|
* configure.in: We do not need to check for broken solaris mutex
|
||||||
|
intitializer any longer. Provide a macro to show the used thread
|
||||||
|
implementation. Not nice, but this is needed until thread support
|
||||||
|
is completed here inside glib.
|
||||||
|
|
||||||
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Here we must replace getpwuid by
|
||||||
|
getpwuid_r, but as I do not know how for now, I just made a FIXME
|
||||||
|
note ;-)
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): localtime --> localtime_r to make it
|
||||||
|
thread safe.
|
||||||
|
|
||||||
|
* configure.in: We do not need to check for broken solaris mutex
|
||||||
|
intitializer any longer. Provide a macro to show the used thread
|
||||||
|
implementation. Not nice, but this is needed until thread support
|
||||||
|
is completed here inside glib.
|
||||||
|
|
||||||
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Here we must replace getpwuid by
|
||||||
|
getpwuid_r, but as I do not know how for now, I just made a FIXME
|
||||||
|
note ;-)
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): localtime --> localtime_r to make it
|
||||||
|
thread safe.
|
||||||
|
|
||||||
|
* configure.in: We do not need to check for broken solaris mutex
|
||||||
|
intitializer any longer. Provide a macro to show the used thread
|
||||||
|
implementation. Not nice, but this is needed until thread support
|
||||||
|
is completed here inside glib.
|
||||||
|
|
||||||
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Here we must replace getpwuid by
|
||||||
|
getpwuid_r, but as I do not know how for now, I just made a FIXME
|
||||||
|
note ;-)
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): localtime --> localtime_r to make it
|
||||||
|
thread safe.
|
||||||
|
|
||||||
|
* configure.in: We do not need to check for broken solaris mutex
|
||||||
|
intitializer any longer. Provide a macro to show the used thread
|
||||||
|
implementation. Not nice, but this is needed until thread support
|
||||||
|
is completed here inside glib.
|
||||||
|
|
||||||
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
Tue Jan 5 12:23:52 PST 1999 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
* configure.in: ditch whitespace before GLIB_SYSDEFS #includes,
|
||||||
|
23
configure.in
23
configure.in
@ -628,35 +628,27 @@ case $have_threads in
|
|||||||
mutex_default_type='pthread_mutex_t'
|
mutex_default_type='pthread_mutex_t'
|
||||||
mutex_default_init='PTHREAD_MUTEX_INITIALIZER'
|
mutex_default_init='PTHREAD_MUTEX_INITIALIZER'
|
||||||
mutex_header_file='pthread.h'
|
mutex_header_file='pthread.h'
|
||||||
|
g_threads_impl="POSIX"
|
||||||
;;
|
;;
|
||||||
solaris)
|
solaris)
|
||||||
G_THREAD_LIBS=error
|
G_THREAD_LIBS=error
|
||||||
AC_CHECK_LIB(thread, cond_init, G_THREAD_LIBS="-lthread")
|
AC_CHECK_LIB(thread, cond_init, G_THREAD_LIBS="-lthread")
|
||||||
# solaris has a broken initializer for mutexes, if we find it,
|
|
||||||
# we will replace it.
|
|
||||||
AC_MSG_CHECKING(for broken solaris mutex initialization)
|
|
||||||
AC_EGREP_CPP([ *begin *{ *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *, *0 *} *end *],
|
|
||||||
[#include <thread.h>
|
|
||||||
begin DEFAULTMUTEX end],
|
|
||||||
[solaris_mutex_init_broken=yes],
|
|
||||||
[solaris_mutex_init_broken=no])
|
|
||||||
AC_MSG_RESULT($solaris_mutex_init_broken)
|
|
||||||
mutex_has_default=yes
|
mutex_has_default=yes
|
||||||
mutex_default_type='mutex_t'
|
mutex_default_type='mutex_t'
|
||||||
if test x$solaris_mutex_init_broken = xyes; then
|
|
||||||
mutex_default_init="{ { { 0, 0, 0, 0 }, USYNC_THREAD }, { { { 0, 0, 0, 0, 0, 0, 0, 0 } } }, 0}"
|
|
||||||
else
|
|
||||||
mutex_default_init="DEFAULTMUTEX"
|
mutex_default_init="DEFAULTMUTEX"
|
||||||
fi
|
|
||||||
mutex_header_file='thread.h'
|
mutex_header_file='thread.h'
|
||||||
|
g_threads_impl="SOLARIS"
|
||||||
;;
|
;;
|
||||||
nspr)
|
nspr)
|
||||||
AC_CHECK_LIB(nspr21, PRP_NewNakedCondVar,
|
AC_CHECK_LIB(nspr21, PRP_NewNakedCondVar,
|
||||||
G_THREAD_LIBS="-lnspr21")
|
G_THREAD_LIBS="-lnspr21")
|
||||||
|
g_threads_impl="NSPR"
|
||||||
;;
|
;;
|
||||||
none)
|
none)
|
||||||
|
g_threads_impl="NONE"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
g_threads_impl="NONE"
|
||||||
G_THREAD_LIBS=error
|
G_THREAD_LIBS=error
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -718,7 +710,6 @@ AC_SUBST(G_THREAD_LIBS)
|
|||||||
|
|
||||||
CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
|
CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
|
||||||
|
|
||||||
|
|
||||||
dnl **********************************************
|
dnl **********************************************
|
||||||
dnl *** GDefaultMutex setup and initialization ***
|
dnl *** GDefaultMutex setup and initialization ***
|
||||||
dnl **********************************************
|
dnl **********************************************
|
||||||
@ -890,6 +881,7 @@ _______EOF
|
|||||||
if test x$g_mutex_has_default = xyes; then
|
if test x$g_mutex_has_default = xyes; then
|
||||||
cat >>$outfile <<_______EOF
|
cat >>$outfile <<_______EOF
|
||||||
$g_enable_threads_def G_THREADS_ENABLED
|
$g_enable_threads_def G_THREADS_ENABLED
|
||||||
|
#define G_THREADS_IMPL_$g_threads_impl_def
|
||||||
typedef struct _GStaticMutex GStaticMutex;
|
typedef struct _GStaticMutex GStaticMutex;
|
||||||
struct _GStaticMutex
|
struct _GStaticMutex
|
||||||
{
|
{
|
||||||
@ -909,6 +901,7 @@ _______EOF
|
|||||||
else
|
else
|
||||||
cat >>$outfile <<_______EOF
|
cat >>$outfile <<_______EOF
|
||||||
$g_enable_threads_def G_THREADS_ENABLED
|
$g_enable_threads_def G_THREADS_ENABLED
|
||||||
|
#define $g_threads_impl_def
|
||||||
typedef struct _GMutex* GStaticMutex;
|
typedef struct _GMutex* GStaticMutex;
|
||||||
#define G_STATIC_MUTEX_INIT NULL
|
#define G_STATIC_MUTEX_INIT NULL
|
||||||
#define g_static_mutex_get_mutex(mutex) (g_static_mutex_get_mutex_impl (&(mutex)))
|
#define g_static_mutex_get_mutex(mutex) (g_static_mutex_get_mutex_impl (&(mutex)))
|
||||||
@ -1182,6 +1175,8 @@ xyes) g_enable_threads_def="#define";;
|
|||||||
*) g_enable_threads_def="#undef ";;
|
*) g_enable_threads_def="#undef ";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
g_threads_impl_def=$g_threads_impl
|
||||||
|
|
||||||
g_mutex_has_default="$mutex_has_default"
|
g_mutex_has_default="$mutex_has_default"
|
||||||
g_mutex_sizeof="$glib_cv_sizeof_gmutex"
|
g_mutex_sizeof="$glib_cv_sizeof_gmutex"
|
||||||
g_mutex_contents="$glib_cv_byte_contents_gmutex"
|
g_mutex_contents="$glib_cv_byte_contents_gmutex"
|
||||||
|
17
gdate.c
17
gdate.c
@ -790,29 +790,22 @@ g_date_set_time (GDate *d,
|
|||||||
GTime time)
|
GTime time)
|
||||||
{
|
{
|
||||||
time_t t = time;
|
time_t t = time;
|
||||||
struct tm *tm;
|
struct tm tm;
|
||||||
|
|
||||||
g_return_if_fail (d != NULL);
|
g_return_if_fail (d != NULL);
|
||||||
|
|
||||||
tm = localtime (&t);
|
localtime_r (&t, &tm);
|
||||||
|
|
||||||
if (tm)
|
|
||||||
{
|
|
||||||
d->julian = FALSE;
|
d->julian = FALSE;
|
||||||
|
|
||||||
d->month = tm->tm_mon + 1;
|
d->month = tm.tm_mon + 1;
|
||||||
d->day = tm->tm_mday;
|
d->day = tm.tm_mday;
|
||||||
d->year = tm->tm_year + 1900;
|
d->year = tm.tm_year + 1900;
|
||||||
|
|
||||||
g_return_if_fail (g_date_valid_dmy (d->day, d->month, d->year));
|
g_return_if_fail (g_date_valid_dmy (d->day, d->month, d->year));
|
||||||
|
|
||||||
d->dmy = TRUE;
|
d->dmy = TRUE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
g_date_clear (d, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
g_date_set_month (GDate *d,
|
g_date_set_month (GDate *d,
|
||||||
|
17
glib/gdate.c
17
glib/gdate.c
@ -790,29 +790,22 @@ g_date_set_time (GDate *d,
|
|||||||
GTime time)
|
GTime time)
|
||||||
{
|
{
|
||||||
time_t t = time;
|
time_t t = time;
|
||||||
struct tm *tm;
|
struct tm tm;
|
||||||
|
|
||||||
g_return_if_fail (d != NULL);
|
g_return_if_fail (d != NULL);
|
||||||
|
|
||||||
tm = localtime (&t);
|
localtime_r (&t, &tm);
|
||||||
|
|
||||||
if (tm)
|
|
||||||
{
|
|
||||||
d->julian = FALSE;
|
d->julian = FALSE;
|
||||||
|
|
||||||
d->month = tm->tm_mon + 1;
|
d->month = tm.tm_mon + 1;
|
||||||
d->day = tm->tm_mday;
|
d->day = tm.tm_mday;
|
||||||
d->year = tm->tm_year + 1900;
|
d->year = tm.tm_year + 1900;
|
||||||
|
|
||||||
g_return_if_fail (g_date_valid_dmy (d->day, d->month, d->year));
|
g_return_if_fail (g_date_valid_dmy (d->day, d->month, d->year));
|
||||||
|
|
||||||
d->dmy = TRUE;
|
d->dmy = TRUE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
g_date_clear (d, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
g_date_set_month (GDate *d,
|
g_date_set_month (GDate *d,
|
||||||
|
@ -416,6 +416,19 @@ g_get_any_init (void)
|
|||||||
g_home_dir = g_strdup (g_getenv ("HOME"));
|
g_home_dir = g_strdup (g_getenv ("HOME"));
|
||||||
|
|
||||||
#ifdef HAVE_PWD_H
|
#ifdef HAVE_PWD_H
|
||||||
|
/* FIXME: we must actually use the getpwuid_r function here, as
|
||||||
|
getpwuid is not MT-safe, but the prototype doesn't seem to be
|
||||||
|
agreed upon on the different systems, i.e. it is
|
||||||
|
|
||||||
|
struct passwd *getpwuid_r(uid_t uid, struct passwd * pwd,
|
||||||
|
char *buffer, int buflen);
|
||||||
|
|
||||||
|
on solaris, but
|
||||||
|
|
||||||
|
int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
|
||||||
|
size_t bufsize struct passwd **result);
|
||||||
|
|
||||||
|
on posix. weird. */
|
||||||
setpwent ();
|
setpwent ();
|
||||||
pw = getpwuid (getuid ());
|
pw = getpwuid (getuid ());
|
||||||
endpwent ();
|
endpwent ();
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* testgthread.c: conditionally compile according to the
|
||||||
|
G_THREADS_IMPL_??? macros.
|
||||||
|
(test_private_func): use rand_r instead of rand to make it
|
||||||
|
thread safe.
|
||||||
|
|
||||||
1998-12-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1998-12-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* testgthread.c (new_thread): As a joinable thread seems to be the
|
* testgthread.c (new_thread): As a joinable thread seems to be the
|
||||||
|
@ -40,12 +40,11 @@ test_mutexes (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NSPR) /* we are using nspr threads */
|
#if defined(G_THREADS_IMPL_NSPR)
|
||||||
/* this option must be specified by hand during compile of
|
#warning "note, that you have to link with whatever library"
|
||||||
testgthread. also note, that you have to link with whatever library
|
#warning "nspr is building upon, it might otherwise (as on solaris) lead to"
|
||||||
nspr is building upon, it might otherwise (as on solaris) lead to
|
#warning "run time failure, as the mutex functions are defined in libc, but"
|
||||||
run time failure, as the mutex functions are defined in libc, but
|
#warning "as noops, that will make some nspr assertions fail."
|
||||||
as noops, that will make some nspr assertions fail. */
|
|
||||||
#include <prthread.h>
|
#include <prthread.h>
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
@ -59,7 +58,8 @@ new_thread (GHookFunc func, gpointer data)
|
|||||||
#define join_thread(thread) PR_JoinThread (thread)
|
#define join_thread(thread) PR_JoinThread (thread)
|
||||||
#define self_thread() PR_GetCurrentThread ()
|
#define self_thread() PR_GetCurrentThread ()
|
||||||
|
|
||||||
#elif defined(DEFAULTMUTEX) /* we are using solaris threads */
|
#elif defined(G_THREADS_IMPL_SOLARIS)
|
||||||
|
#include <thread.h>
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
new_thread (GHookFunc func, gpointer data)
|
new_thread (GHookFunc func, gpointer data)
|
||||||
@ -72,7 +72,9 @@ new_thread (GHookFunc func, gpointer data)
|
|||||||
thr_join ((thread_t)GPOINTER_TO_UINT (thread), NULL, NULL)
|
thr_join ((thread_t)GPOINTER_TO_UINT (thread), NULL, NULL)
|
||||||
#define self_thread() GUINT_TO_POINTER (thr_self ())
|
#define self_thread() GUINT_TO_POINTER (thr_self ())
|
||||||
|
|
||||||
#elif defined(PTHREAD_MUTEX_INITIALIZER) /* we are using posix threads */
|
#elif defined(G_THREADS_IMPL_POSIX)
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
new_thread(GHookFunc func, gpointer data)
|
new_thread(GHookFunc func, gpointer data)
|
||||||
{
|
{
|
||||||
@ -151,10 +153,17 @@ void
|
|||||||
test_private_func (void *data)
|
test_private_func (void *data)
|
||||||
{
|
{
|
||||||
guint i = 0;
|
guint i = 0;
|
||||||
|
static unsigned int seed = 0;
|
||||||
|
if (!seed)
|
||||||
|
{
|
||||||
|
GTimeVal now;
|
||||||
|
g_get_current_time (&now);
|
||||||
|
seed = now.tv_usec;
|
||||||
|
}
|
||||||
wait_thread (1);
|
wait_thread (1);
|
||||||
while (i < TEST_PRIVATE_ROUNDS)
|
while (i < TEST_PRIVATE_ROUNDS)
|
||||||
{
|
{
|
||||||
guint random_value = rand () % 10000;
|
guint random_value = rand_r (&seed) % 10000;
|
||||||
guint *data = g_static_private_get (&private_key);
|
guint *data = g_static_private_get (&private_key);
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
13
gutils.c
13
gutils.c
@ -416,6 +416,19 @@ g_get_any_init (void)
|
|||||||
g_home_dir = g_strdup (g_getenv ("HOME"));
|
g_home_dir = g_strdup (g_getenv ("HOME"));
|
||||||
|
|
||||||
#ifdef HAVE_PWD_H
|
#ifdef HAVE_PWD_H
|
||||||
|
/* FIXME: we must actually use the getpwuid_r function here, as
|
||||||
|
getpwuid is not MT-safe, but the prototype doesn't seem to be
|
||||||
|
agreed upon on the different systems, i.e. it is
|
||||||
|
|
||||||
|
struct passwd *getpwuid_r(uid_t uid, struct passwd * pwd,
|
||||||
|
char *buffer, int buflen);
|
||||||
|
|
||||||
|
on solaris, but
|
||||||
|
|
||||||
|
int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
|
||||||
|
size_t bufsize struct passwd **result);
|
||||||
|
|
||||||
|
on posix. weird. */
|
||||||
setpwent ();
|
setpwent ();
|
||||||
pw = getpwuid (getuid ());
|
pw = getpwuid (getuid ());
|
||||||
endpwent ();
|
endpwent ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user