[ltt-dev] [RFC PATCHv2 1/5] urcu:rename tid to pthread

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Mon Aug 22 08:08:53 EDT 2011


* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>

Is the purpose of this patch to remove confusion between the value
returned by the syscall gettid() and the value returned by pthread_self?
If so, it should be documented in the patch changelog.

Thanks,

Mathieu

> ---
>  urcu.c             |    6 +++---
>  urcu/static/urcu.h |    2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/urcu.c b/urcu.c
> index 2339bc6..039df55 100644
> --- a/urcu.c
> +++ b/urcu.c
> @@ -160,7 +160,7 @@ static void force_mb_all_readers(void)
>  	 */
>  	cds_list_for_each_entry(index, &registry, node) {
>  		CMM_STORE_SHARED(index->need_mb, 1);
> -		pthread_kill(index->tid, SIGRCU);
> +		pthread_kill(index->pthread, SIGRCU);
>  	}
>  	/*
>  	 * Wait for sighandler (and thus mb()) to execute on every thread.
> @@ -177,7 +177,7 @@ static void force_mb_all_readers(void)
>  	 */
>  	cds_list_for_each_entry(index, &registry, node) {
>  		while (CMM_LOAD_SHARED(index->need_mb)) {
> -			pthread_kill(index->tid, SIGRCU);
> +			pthread_kill(index->pthread, SIGRCU);
>  			poll(NULL, 0, 1);
>  		}
>  	}
> @@ -351,7 +351,7 @@ void rcu_read_unlock(void)
>  
>  void rcu_register_thread(void)
>  {
> -	rcu_reader.tid = pthread_self();
> +	rcu_reader.pthread = pthread_self();
>  	assert(rcu_reader.need_mb == 0);
>  	assert(!(rcu_reader.ctr & RCU_GP_CTR_NEST_MASK));
>  
> diff --git a/urcu/static/urcu.h b/urcu/static/urcu.h
> index 0295a3e..cfcb300 100644
> --- a/urcu/static/urcu.h
> +++ b/urcu/static/urcu.h
> @@ -231,7 +231,7 @@ struct rcu_reader {
>  	char need_mb;
>  	/* Data used for registry */
>  	struct cds_list_head node __attribute__((aligned(CAA_CACHE_LINE_SIZE)));
> -	pthread_t tid;
> +	pthread_t pthread;
>  };
>  
>  extern struct rcu_reader __thread rcu_reader;
> -- 
> 1.7.4.4
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




More information about the lttng-dev mailing list