Steven Dake wrote:
> Im hesitant to merge this patch without further testing that it doesn't
> impact ipc behavior.

You're probably right to be cautious.
FWIW, I made that change only after reading "man pthread_create"
a few times:

     int pthread_create(pthread_t *restrict thread,
            const pthread_attr_t *restrict attr,
            void *(*start_routine)(void*), void *restrict arg);

     The thread is created executing start_routine  with  arg  as  its  sole
     argument. If the start_routine returns, the effect shall be as if there
     was an implicit call  to  pthread_exit()  using  the  return  value  of
     start_routine  as the exit status. Note that the thread in which main()
     was originally invoked differs from this. When it returns from  main(),
     the  effect  shall  be as if there was an implicit call to exit() using
     the return value of main() as the exit status.

I confess: I ran no tests ;-)

> On Mon, 2009-03-30 at 20:28 +0200, Jim Meyering wrote:
>> From: Jim Meyering <[email protected]>
>>
>> * exec/coroipcs.c (pthread_ipc_consumer): Return NULL rather than
>> calling pthread_exit explicitly.  When a pthread_create callback
>> function like this one returns NULL, it's equivalent to calling
>> pthread_exit(0).
>> Remove unreached call to pthread_exit after infloop.
>> ---
>>  exec/coroipcs.c |    5 ++---
>>  1 files changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/exec/coroipcs.c b/exec/coroipcs.c
>> index 4be798f..ab05bf7 100644
>> --- a/exec/coroipcs.c
>> +++ b/exec/coroipcs.c
>> @@ -264,7 +264,7 @@ static void *pthread_ipc_consumer (void *conn)
>>              struct sched_param sched_param;
>>
>>              sched_param.sched_priority = api->sched_priority;
>> -            res = pthread_setschedparam (conn_info->thread, SCHED_RR, 
>> &sched_param);
>> +            pthread_setschedparam (conn_info->thread, SCHED_RR, 
>> &sched_param);
>>      }
>>
>>      for (;;) {
>> @@ -282,7 +282,7 @@ retry_semop:
>>              } else
>>              if ((res == -1) && (errno == EINVAL || errno == EIDRM)) {
>>                      coroipcs_refcount_dec (conn_info);
>> -                    pthread_exit (0);
>> +                    return NULL;
>>              }
>>
>>              coroipcs_refcount_inc (conn_info);
>> @@ -314,7 +314,6 @@ retry_semop:
>>              api->sending_allowed_release 
>> (conn_info->sending_allowed_private_data);
>>              coroipcs_refcount_dec (conn);
>>      }
>> -    pthread_exit (0);
>>  }
>>
>>  static int
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to