source: rtems/cpukit/posix/src/psignalunblockthread.c @ 874297f3

4.104.114.84.9
Last change on this file since 874297f3 was 874297f3, checked in by Ralf Corsepius <ralf.corsepius@…>, on Apr 16, 2004 at 10:01:03 AM

Remove stray white spaces.

  • 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.