components/pigz/patches/200_named-threads.patch
changeset 7063 c478967a99d2
parent 3924 6200b874acbb
equal deleted inserted replaced
7062:7c249efbfc20 7063:c478967a99d2
     5 # Node ID 0293c398eda727bf812a867600a25b7831928db7
     5 # Node ID 0293c398eda727bf812a867600a25b7831928db7
     6 # Parent  b63f212d891d9cffbc8f4a0e2293532fe44aaa16
     6 # Parent  b63f212d891d9cffbc8f4a0e2293532fe44aaa16
     7 name threads to improve observability - developed by Oracle
     7 name threads to improve observability - developed by Oracle
     8 Not submitted upstream: Uses feature first present in Solaris 12
     8 Not submitted upstream: Uses feature first present in Solaris 12
     9 
     9 
    10 diff -r b63f212d891d -r 0293c398eda7 yarn.c
    10 --- pigz-2.3.3/yarn.c.orig	2016-09-26 10:55:04.395234262 +0000
    11 --- a/yarn.c
    11 +++ pigz-2.3.3/yarn.c	2016-09-26 10:57:33.364488635 +0000
    12 +++ b/yarn.c
    12 @@ -262,7 +262,12 @@
    13 @@ -258,7 +258,12 @@
       
    14  
    13  
    15  /* not all POSIX implementations create threads as joinable by default, so that
    14  /* not all POSIX implementations create threads as joinable by default, so that
    16     is made explicit here */
    15     is made explicit here */
    17 +#ifdef HAVE_PTHREAD_SETNAME_NP
    16 +#ifdef HAVE_PTHREAD_SETNAME_NP
    18 +#undef launch
    17 +#undef launch
    21  thread *launch(void (*probe)(void *), void *payload)
    20  thread *launch(void (*probe)(void *), void *payload)
    22 +#endif
    21 +#endif
    23  {
    22  {
    24      int ret;
    23      int ret;
    25      thread *th;
    24      thread *th;
    26 @@ -284,7 +289,9 @@
    25 @@ -288,7 +293,9 @@
    27          (ret = pthread_create(&(th->id), &attr, ignition, capsule)) ||
    26          (ret = pthread_create(&(th->id), &attr, ignition, capsule)) ||
    28          (ret = pthread_attr_destroy(&attr)))
    27          (ret = pthread_attr_destroy(&attr)))
    29          fail(ret);
    28          fail(ret);
    30 -
    29 -
    31 +#ifdef HAVE_PTHREAD_SETNAME_NP
    30 +#ifdef HAVE_PTHREAD_SETNAME_NP
    32 +    (void)pthread_setname_np(th->id, probename);
    31 +    (void)pthread_setname_np(th->id, probename);
    33 +#endif
    32 +#endif
    34      /* put the thread in the threads list for join_all() */
    33      /* put the thread in the threads list for join_all() */
    35      th->done = 0;
    34      th->done = 0;
    36      th->next = threads;
    35      th->next = threads;
    37 diff -r b63f212d891d -r 0293c398eda7 yarn.h
    36 --- pigz-2.3.3/yarn.h.orig	2016-09-26 10:57:54.883094290 +0000
    38 --- a/yarn.h
    37 +++ pigz-2.3.3/yarn.h	2016-09-26 10:58:28.855091969 +0000
    39 +++ b/yarn.h
       
    40 @@ -115,7 +115,12 @@
    38 @@ -115,7 +115,12 @@
    41  void yarn_mem(void *(*)(size_t), void (*)(void *));
    39  void yarn_mem(void *(*)(size_t), void (*)(void *));
    42  
    40  
    43  typedef struct thread_s thread;
    41  typedef struct thread_s thread;
    44 +#ifdef HAVE_PTHREAD_SETNAME_NP
    42 +#ifdef HAVE_PTHREAD_SETNAME_NP