OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [psignalunblockthread.c] - Blame information for rev 609

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: psignalunblockthread.c,v 1.2 2001-09-27 11:59:17 chris Exp $
3
 */
4
 
5
#include <assert.h>
6
#include <errno.h>
7
#include <pthread.h>
8
#include <signal.h>
9
 
10
#include <rtems/system.h>
11
#include <rtems/score/isr.h>
12
#include <rtems/score/thread.h>
13
#include <rtems/score/tqdata.h>
14
#include <rtems/score/wkspace.h>
15
#include <rtems/posix/seterr.h>
16
#include <rtems/posix/threadsup.h>
17
#include <rtems/posix/psignal.h>
18
#include <rtems/posix/pthread.h>
19
#include <rtems/posix/time.h>
20
#include <stdio.h>
21
 
22
 
23
/*PAGE
24
 *
25
 *  _POSIX_signals_Unblock_thread
26
 */
27
 
28
/* XXX this routine could probably be cleaned up */
29
boolean _POSIX_signals_Unblock_thread(
30
  Thread_Control  *the_thread,
31
  int              signo,
32
  siginfo_t       *info
33
)
34
{
35
  POSIX_API_Control  *api;
36
  sigset_t            mask;
37
  siginfo_t          *the_info = NULL;
38
 
39
  api = the_thread->API_Extensions[ THREAD_API_POSIX ];
40
 
41
  mask = signo_to_mask( signo );
42
 
43
  /*
44
   *  Is the thread is specifically waiting for a signal?
45
   */
46
 
47
  if ( _States_Is_interruptible_signal( the_thread->current_state ) ) {
48
 
49
    if ( (the_thread->Wait.option & mask) || (~api->signals_blocked & mask) ) {
50
      the_thread->Wait.return_code = EINTR;
51
 
52
      the_info = (siginfo_t *) the_thread->Wait.return_argument;
53
 
54
      if ( !info ) {
55
        the_info->si_signo = signo;
56
        the_info->si_code = SI_USER;
57
        the_info->si_value.sival_int = 0;
58
      } else {
59
        *the_info = *info;
60
      }
61
 
62
      _Thread_queue_Extract_with_proxy( the_thread );
63
      return TRUE;
64
    }
65
 
66
    /*
67
     *  This should only be reached via pthread_kill().
68
     */
69
 
70
    return FALSE;
71
  }
72
 
73
  if ( ~api->signals_blocked & mask ) {
74
    the_thread->do_post_task_switch_extension = TRUE;
75
 
76
    if ( the_thread->current_state & STATES_INTERRUPTIBLE_BY_SIGNAL ) {
77
      the_thread->Wait.return_code = EINTR;
78
      if ( _States_Is_waiting_on_thread_queue(the_thread->current_state) )
79
        _Thread_queue_Extract_with_proxy( the_thread );
80
      else if ( _States_Is_delaying(the_thread->current_state)){
81
        if ( _Watchdog_Is_active( &the_thread->Timer ) )
82
          (void) _Watchdog_Remove( &the_thread->Timer );
83
        _Thread_Unblock( the_thread );
84
      }
85
    }
86
  }
87
  return FALSE;
88
 
89
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.