This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: global variables within library __thread


Hi

Putting into header has same effect as static global, isn't it?
static global is as far as I now how you do a semaphore.


On Sat, Oct 17, 2015 at 5:56 PM, JoÃl KrÃhemann <weedlight@gmail.com> wrote:
> ... and as told these variables should be per process so putting into header
> is definitively no option, think so.
>
>
> On Sat, Oct 17, 2015 at 5:49 PM, JoÃl KrÃhemann <weedlight@gmail.com> wrote:
>> Hi
>>
>> First of all it is located in the ags_thread-posix.c file but as
>> putting it into the header i get
>> something like:
>>
>> /usr/bin/ld: ags_thread_self: TLS definition in gsequencer-main.o
>> section .tbss mismatches non-TLS reference in .libs/gsequencerS.o
>> .libs/gsequencerS.o: error adding symbols: Bad value
>> collect2: error: ld returned 1 exit status
>> libtool: link: rm -f ".libs/gsequencerS.o"
>> Makefile:2010: recipe for target 'gsequencer' failed
>> make[1]: *** [gsequencer] Error 1
>> make[1]: Leaving directory '/home/joelkraehemann/gsequencer'
>> Makefile:1854: recipe for target 'all' failed
>> make: *** [all] Error 2
>>
>> This reference isn't used anywhere but in ags_thread-posix.c. Further
>> main.c doesn't contain any
>> references to it. For completion here's the code of the functions using it:
>>
>>
>> void
>> ags_thread_resume_handler(int sig)
>> {
>>   if(ags_thread_self == NULL){
>>     return;
>>   }
>>
>> #ifdef AGS_DEBUG
>>   g_message("thread resume\0");
>> #endif
>>
>>   g_atomic_int_and(&(ags_thread_self->flags),
>>                    (~AGS_THREAD_SUSPENDED));
>>
>>   ags_thread_resume(ags_thread_self);
>> }
>>
>> void
>> ags_thread_suspend_handler(int sig)
>> {
>> #ifdef AGS_DEBUG
>>   g_message("thread suspend\0");
>> #endif
>>
>>   if(ags_thread_self == NULL){
>>     return;
>>   }
>>
>>   if ((AGS_THREAD_SUSPENDED &
>> (g_atomic_int_get(&(ags_thread_self->flags)))) != 0) return;
>>
>>   g_atomic_int_or(&(ags_thread_self->flags),
>>                   AGS_THREAD_SUSPENDED);
>>
>>   ags_thread_suspend(ags_thread_self);
>>
>>   do sigsuspend(&(ags_thread_self->wait_mask)); while
>> ((AGS_THREAD_SUSPENDED &
>> (g_atomic_int_get(&(ags_thread_self->flags)))) != 0);
>> }
>>
>>
>> cheers,
>> JoÃl
>>
>>
>> On Sat, Oct 17, 2015 at 4:51 AM, Mike Frysinger <vapier@gentoo.org> wrote:
>>> On 17 Oct 2015 00:31, JoÃl KrÃhemann wrote:
>>>> __thread AgsThread *ags_thread_self = NULL;
>>>>
>>>> /usr/bin/ld: ags_thread_self: TLS definition in
>>>> /home/joelkraehemann/gsequencer/.libs/libags_thread.a(libags_thread_la-ags_thread-posix.o)
>>>> section .tbss mismatches non-TLS reference in .libs/gsequencerS.o
>>>
>>> make sure the header that declares this also has __thread markings.
>>> declaring it in the header like this would be wrong:
>>>         extern AgsThread *ags_thread_self;
>>> -mike


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]