From 8dd3b8aaa54a0c3a2661df4f8f629a3b5085d37b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 13 Sep 2014 09:47:47 +0200 Subject: group gid and group name, in libgamma-error, are thread local MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- info/libgamma.texinfo | 7 +++++-- src/lib/libgamma-error.c.gpp | 6 +++++- src/lib/libgamma-error.h | 6 +++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/info/libgamma.texinfo b/info/libgamma.texinfo index 1903144..eb3cfd3 100644 --- a/info/libgamma.texinfo +++ b/info/libgamma.texinfo @@ -1280,8 +1280,11 @@ group is stored in @code{libgamma_group_name}. @code{NULL} is stored if the name of the group cannto be determined. @file{libgamma.h} give you access to these variables, they are defined -as @code{gid_t} and @code{const char*} types -respectively. +as @code{gid_t} (@code{short int} for Windows) +and @code{const char*} types respectively. +Additionally, except on Windows, these use thread +local storage, defined with the @code{__thread} +modifier. @command{libgamma} defines the following error codes that its functions may return: diff --git a/src/lib/libgamma-error.c.gpp b/src/lib/libgamma-error.c.gpp index 717f11b..1cc81ac 100644 --- a/src/lib/libgamma-error.c.gpp +++ b/src/lib/libgamma-error.c.gpp @@ -38,7 +38,7 @@ $>export PATH=".:${PATH}" * `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned. */ #ifndef __WIN32__ -gid_t libgamma_group_gid = 0; +__thread gid_t libgamma_group_gid = 0; #else short libgamma_group_gid = 0; #endif @@ -49,7 +49,11 @@ short libgamma_group_gid = 0; * `NULL` if the name of the group `libgamma_group_gid` * cannot be determined. */ +#ifndef __WIN32__ +__thread const char* libgamma_group_name = NULL; +#else const char* libgamma_group_name = NULL; +#endif diff --git a/src/lib/libgamma-error.h b/src/lib/libgamma-error.h index 7d38568..77564d7 100644 --- a/src/lib/libgamma-error.h +++ b/src/lib/libgamma-error.h @@ -35,7 +35,7 @@ * `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned. */ #ifndef __WIN32__ -extern gid_t libgamma_group_gid; +extern __thread gid_t libgamma_group_gid; #else extern short libgamma_group_gid; #endif @@ -46,7 +46,11 @@ extern short libgamma_group_gid; * `NULL` if the name of the group `libgamma_group_gid` * cannot be determined. */ +#ifndef __WIN32__ +extern __thread const char* libgamma_group_name; +#else extern const char* libgamma_group_name; +#endif /** -- cgit v1.2.3-70-g09d2