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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [posix/] [src/] [psignalunblockthread.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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