[PATCH 3/3] Add test for fetching TLS from core file

Simon Marchi simon.marchi@polymtl.ca
Thu Oct 19 20:14:00 GMT 2017


On 2017-10-18 09:35, Maciej W. Rozycki wrote:
>> +int
>> +main (void)
>> +{
>> +  pthread_t threads[NUMBER_OF_THREADS];
>> +  int i;
>> +  for (i = 0; i < NUMBER_OF_THREADS; i++)
>> +    pthread_create (&threads[i], NULL, thread, &i);
> 
>  Missing `return' statement here.
> 
>  Also `while (1) sleep (10);' perhaps, so that you don't cause a race 
> with
> the whole process terminating (I think `pthread_join (&threads[0], 
> NULL);'
> would do too; I'm sure there are other ways as well to prevent from
> running to exit(2)).  Overall please don't assume any particular thread
> scheduling characteristics of the underlying OS, and especially on SMP
> systems effects may be sometimes surprising.

Just make sure to avoid an infinite loop, in case the inferior is 
somehow left running after executing the test because of some bug 
somewhere.

Simon



More information about the Binutils mailing list