Ejemplo n.º 1
0
extern int std_resume_task(std_task_id_t taskId)
{
#if 0
    return pthread_suspend_np(taskId) == 0 ? 1 : 0;
#else
    return 1;
#endif
}
Ejemplo n.º 2
0
int sigsuspend(const rtl_sigset_t *sigmask){
  rtl_sigset_t oset;
  int flags;  
#if CONFIG_KERNEL_MEMORYPROT
  mprot_t mprot;
#endif  
  pthread_t self=pthread_self();
 
  STARTKERNELCODE(mprot);
  
  if (!sigmask) {
    errno=EFAULT;
    ENDKERNELCODE(mprot);
    return -1;
  }

  rtl_no_interrupts(flags);

  // Backup old mask.
  oset=self->blocked;

  /*
    Instaure new.

    With pthread_sigmask RTLINUX scheduler signals can't be blocked
    or unblocked.     
    0 .. 6 from oset, 7 .. 31 to 0 OR 
    0 .. 6 to 0, 7 .. 31 from sigmask    
  */
  self->blocked= (oset & ~RTL_THREAD_SIGNALS_MASK) | (*sigmask & RTL_THREAD_SIGNALS_MASK) ;
  // Mark as interrumpible by a signal.
  set_bit(RTL_THREAD_SIGNAL_INTERRUMPIBLE,&self->threadflags);
  // Suspend calling thread until a signal arrives.
  pthread_suspend_np(self);  
  
  // do_user_signal clears the bit RTL_THREAD_SIGNAL_INTERRUMPIBLE from threadflags.
  if (!test_and_clear_bit(RTL_THREAD_SIGNAL_INTERRUMPIBLE,&self->threadflags)){
    errno=EINTR;
  }

  // Restore thread blocked set.
  self->blocked=oset;
  rtl_restore_interrupts(flags);
 
  ENDKERNELCODE(mprot);
  
  return -1;
}