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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  3.3.5 Examine and Change Blocked Signals, P1003.1b-1993, p. 73
3
 *
4
 *  NOTE: P1003.1c/D10, p. 37 adds pthread_sigmask().
5
 *
6
 *  COPYRIGHT (c) 1989-1999.
7
 *  On-Line Applications Research Corporation (OAR).
8
 *
9
 *  The license and distribution terms for this file may be
10
 *  found in the file LICENSE in this distribution or at
11
 *  http://www.OARcorp.com/rtems/license.html.
12
 *
13
 *  $Id: pthreadsigmask.c,v 1.2 2001-09-27 11:59:17 chris Exp $
14
 */
15
 
16
 
17
#include <pthread.h>
18
#include <signal.h>
19
#include <errno.h>
20
 
21
#include <rtems/system.h>
22
#include <rtems/posix/pthread.h>
23
#include <rtems/posix/psignal.h>
24
#include <rtems/posix/seterr.h>
25
 
26
int pthread_sigmask(
27
  int               how,
28
  const sigset_t   *set,
29
  sigset_t         *oset
30
)
31
{
32
  POSIX_API_Control  *api;
33
 
34
  if ( !set && !oset )
35
    set_errno_and_return_minus_one( EINVAL );
36
 
37
  api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
38
 
39
  if ( oset )
40
    *oset = api->signals_blocked;
41
 
42
  if ( !set )
43
    return 0;
44
 
45
  switch ( how ) {
46
    case SIG_BLOCK:
47
      api->signals_blocked |= *set;
48
      break;
49
    case SIG_UNBLOCK:
50
      api->signals_blocked &= ~*set;
51
      break;
52
    case SIG_SETMASK:
53
      api->signals_blocked = *set;
54
      break;
55
    default:
56
      set_errno_and_return_minus_one( EINVAL );
57
  }
58
 
59
  /* XXX are there critical section problems here? */
60
 
61
  /* XXX evaluate the new set */
62
 
63
  if ( ~api->signals_blocked &
64
       (api->signals_pending | _POSIX_signals_Pending) ) {
65
    _Thread_Executing->do_post_task_switch_extension = TRUE;
66
    _Thread_Dispatch();
67
  }
68
 
69
  return 0;
70
}

powered by: WebSVN 2.1.0

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