Deleted Added
full compact
thr_init.c (17706) thr_init.c (22315)
1/*
2 * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 30 unchanged lines hidden (view full) ---

39#include <string.h>
40#include <fcntl.h>
41#include <unistd.h>
42#include <sys/time.h>
43#ifdef _THREAD_SAFE
44#include <machine/reg.h>
45#include <pthread.h>
46#include "pthread_private.h"
1/*
2 * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 30 unchanged lines hidden (view full) ---

39#include <string.h>
40#include <fcntl.h>
41#include <unistd.h>
42#include <sys/time.h>
43#ifdef _THREAD_SAFE
44#include <machine/reg.h>
45#include <pthread.h>
46#include "pthread_private.h"
47extern int _thread_autoinit_dummy_decl;
47
48
49/*
50 * Threaded process initialization
51 */
48void
49_thread_init(void)
50{
51 int flags;
52 int i;
53 struct sigaction act;
54
52void
53_thread_init(void)
54{
55 int flags;
56 int i;
57 struct sigaction act;
58
59 /* Ensure that the auto-initialization routine is linked in: */
60 _thread_autoinit_dummy_decl = 1;
61
55 /* Check if this function has already been called: */
62 /* Check if this function has already been called: */
56 if (_thread_initial) {
63 if (_thread_initial)
57 /* Only initialise the threaded application once. */
64 /* Only initialise the threaded application once. */
58 }
65 return;
66
67 /* Get the standard I/O flags before messing with them : */
68 for (i = 0; i < 3; i++)
69 if ((_pthread_stdio_flags[i] =
70 _thread_sys_fcntl(i,F_GETFL, NULL)) == -1)
71 PANIC("Cannot get stdio flags");
72
59 /*
60 * Create a pipe that is written to by the signal handler to prevent
61 * signals being missed in calls to _thread_sys_select:
62 */
73 /*
74 * Create a pipe that is written to by the signal handler to prevent
75 * signals being missed in calls to _thread_sys_select:
76 */
63 else if (_thread_sys_pipe(_thread_kern_pipe) != 0) {
77 if (_thread_sys_pipe(_thread_kern_pipe) != 0) {
64 /* Cannot create pipe, so abort: */
65 PANIC("Cannot create kernel pipe");
66 }
67 /* Get the flags for the read pipe: */
68 else if ((flags = _thread_sys_fcntl(_thread_kern_pipe[0], F_GETFL, NULL)) == -1) {
69 /* Abort this application: */
70 PANIC("Cannot get kernel read pipe flags");
71 }

--- 143 unchanged lines hidden ---
78 /* Cannot create pipe, so abort: */
79 PANIC("Cannot create kernel pipe");
80 }
81 /* Get the flags for the read pipe: */
82 else if ((flags = _thread_sys_fcntl(_thread_kern_pipe[0], F_GETFL, NULL)) == -1) {
83 /* Abort this application: */
84 PANIC("Cannot get kernel read pipe flags");
85 }

--- 143 unchanged lines hidden ---