Diff for /libaitsched/src/hooks.c between versions 1.14.2.4 and 1.14.2.5

version 1.14.2.4, 2012/08/22 23:47:22 version 1.14.2.5, 2012/08/23 00:31:41
Line 209  sched_hook_cancel(void *task, void *arg __unused) Line 209  sched_hook_cancel(void *task, void *arg __unused)
 #endif  #endif
                 case taskTHREAD:                  case taskTHREAD:
 #ifdef HAVE_LIBPTHREAD  #ifdef HAVE_LIBPTHREAD
                        /* try to wait for valid thread id */                        for (i = 0; i < MAX_TASK_MISS; i++)
                        for (i = 0; i < MAX_TASK_MISS &&                                 if (!pthread_cancel((pthread_t) TASK_VAL(t))) {
                                        pthread_kill((pthread_t) TASK_VAL(t), 0); i++)                                        /* joinable thread */
                                usleep(10);                                        if (TASK_FLAG(t) == PTHREAD_CREATE_JOINABLE)
                        /* try to sure thread is cancelled */                                                schedTask(TASK_ROOT(t), _sched_threadJoin, 
                        for (i = 0; i < MAX_TASK_MISS &&                                                                 TASK_ARG(t), TASK_VAL(t), 
                                        !pthread_kill((pthread_t) TASK_VAL(t), 0); i++)                                                                TASK_DATA(t), TASK_DATLEN(t));
                                pthread_cancel((pthread_t) TASK_VAL(t));                                        return NULL;
                        if (TASK_FLAG(t) == PTHREAD_CREATE_JOINABLE)    /* joinable thread */                                }
                                schedTask(TASK_ROOT(t), _sched_threadJoin, TASK_ARG(t),                        return (void*) -1;
                                                TASK_VAL(t), TASK_DATA(t), TASK_DATLEN(t)); 
 #endif  #endif
                         TASK_UNLOCK(t);  
                 default:                  default:
                         return NULL;                          return NULL;
         }          }
Line 243  sched_hook_thread(void *task, void *arg) Line 241  sched_hook_thread(void *task, void *arg)
 {  {
         sched_task_t *t = task;          sched_task_t *t = task;
         pthread_t tid;          pthread_t tid;
        sigset_t ns, os;        sigset_t s, o;
   
         if (!t || !TASK_ROOT(t))          if (!t || !TASK_ROOT(t))
                 return (void*) -1;                  return (void*) -1;
   
        sigfillset(&ns);        sigfillset(&s);
        pthread_sigmask(SIG_BLOCK, &ns, &os);        pthread_sigmask(SIG_BLOCK, &s, &o);
         if (pthread_create(&tid, (pthread_attr_t*) arg,           if (pthread_create(&tid, (pthread_attr_t*) arg, 
                                 (void *(*)(void*)) TASK_FUNC(t), t)) {                                  (void *(*)(void*)) TASK_FUNC(t), t)) {
                 LOGERR;                  LOGERR;
                pthread_sigmask(SIG_SETMASK, &os, NULL);                pthread_sigmask(SIG_SETMASK, &o, NULL);
                 return (void*) -1;                  return (void*) -1;
         }          }
   
Line 261  sched_hook_thread(void *task, void *arg) Line 259  sched_hook_thread(void *task, void *arg)
                 TASK_LOCK(t);                  TASK_LOCK(t);
   
         TASK_VAL(t) = (u_long) tid;          TASK_VAL(t) = (u_long) tid;
        pthread_sigmask(SIG_SETMASK, &os, NULL);        pthread_sigmask(SIG_SETMASK, &o, NULL);
         return NULL;          return NULL;
 }  }
 #endif  #endif

Removed from v.1.14.2.4  
changed lines
  Added in v.1.14.2.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>