source: rtems/cpukit/posix/src/psignalunblockthread.c @ f22ebf0

4.104.114.84.95
Last change on this file since f22ebf0 was f42b726, checked in by Joel Sherrill <joel.sherrill@…>, on 01/24/01 at 14:17:28

2001-01-24 Ralf Corsepius <corsepiu@…>

  • configure.in: Add src/config.h
  • src/Makefile.am: Add INCLUDES += -I. to pickup config.h
  • src/.cvsignore: Add config.h and stamp-h
  • src/*.c: Add config.h support.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  $Id$
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 */
33boolean _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}
Note: See TracBrowser for help on using the repository browser.