Diff for /libaitsched/src/hooks.c between versions 1.14.2.3 and 1.17

version 1.14.2.3, 2012/08/22 23:43:36 version 1.17, 2013/05/30 09:13:52
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 110  sched_hook_cancel(void *task, void *arg __unused) Line 110  sched_hook_cancel(void *task, void *arg __unused)
 #ifdef AIO_SUPPORT  #ifdef AIO_SUPPORT
         struct aiocb *acb;          struct aiocb *acb;
 #ifdef EVFILT_LIO  #ifdef EVFILT_LIO
           register int i = 0;
         struct aiocb **acbs;          struct aiocb **acbs;
         register int i;  
 #endif  /* EVFILT_LIO */  #endif  /* EVFILT_LIO */
 #endif  /* AIO_SUPPORT */  #endif  /* AIO_SUPPORT */
   
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 */                        pthread_cancel((pthread_t) TASK_VAL(t));
                        for (i = 0; i < MAX_TASK_MISS &&  
                                        pthread_kill((pthread_t) TASK_VAL(t), 0); i++) 
                                usleep(10); 
                        /* try to sure thread is cancelled */ 
                        for (i = 0; i < MAX_TASK_MISS &&  
                                        !pthread_kill((pthread_t) TASK_VAL(t), 0); i++) 
                                pthread_cancel((pthread_t) TASK_VAL(t)); 
                        if (TASK_FLAG(t) == PTHREAD_CREATE_JOINABLE)    /* joinable thread */ 
                                schedTask(TASK_ROOT(t), _sched_threadJoin, TASK_ARG(t), 
                                                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 232  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 ((errno = pthread_create(&tid, (pthread_attr_t*) arg, 
                                (void *(*)(void*)) TASK_FUNC(t), t)) {                                (void *(*)(void*)) _sched_threadWrapper, t))) {
                 LOGERR;                  LOGERR;
                pthread_sigmask(SIG_SETMASK, &os, NULL);                pthread_sigmask(SIG_SETMASK, &o, NULL);
                 return (void*) -1;                  return (void*) -1;
        }        } else
                 TASK_VAL(t) = (u_long) tid;
   
         if (!TASK_ISLOCKED(t))          if (!TASK_ISLOCKED(t))
                 TASK_LOCK(t);                  TASK_LOCK(t);
   
        TASK_VAL(t) = (u_long) tid;        pthread_sigmask(SIG_SETMASK, &o, NULL);
        pthread_sigmask(SIG_SETMASK, &os, NULL); 
         return NULL;          return NULL;
 }  }
 #endif  #endif

Removed from v.1.14.2.3  
changed lines
  Added in v.1.17


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