Subversion Repositories Kolibri OS

Rev

Rev 4921 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4921 Rev 6099
Line 77... Line 77...
77
  __lock_acquire_recursive(__atexit_lock);
77
  __lock_acquire_recursive(__atexit_lock);
78
#endif
78
#endif
Line 79... Line 79...
79
 
79
 
80
  p = _GLOBAL_ATEXIT;
80
  p = _GLOBAL_ATEXIT;
-
 
81
  if (p == NULL)
81
  if (p == NULL)
82
    {
-
 
83
      _GLOBAL_ATEXIT = p = _GLOBAL_ATEXIT0;
-
 
84
#ifdef _REENT_SMALL
-
 
85
      extern struct _on_exit_args * const __on_exit_args _ATTRIBUTE ((weak));
-
 
86
      if (&__on_exit_args != NULL)
-
 
87
	p->_on_exit_args_ptr = __on_exit_args;
-
 
88
#endif	/* def _REENT_SMALL */
82
    _GLOBAL_ATEXIT = p = _GLOBAL_ATEXIT0;
89
    }
83
  if (p->_ind >= _ATEXIT_SIZE)
90
  if (p->_ind >= _ATEXIT_SIZE)
84
    {
91
    {
-
 
92
#ifndef _ATEXIT_DYNAMIC_ALLOC
-
 
93
#ifndef __SINGLE_THREAD__
-
 
94
      __lock_release_recursive(__atexit_lock);
85
#ifndef _ATEXIT_DYNAMIC_ALLOC
95
#endif
86
      return -1;
96
      return -1;
87
#else
97
#else
88
      /* Don't dynamically allocate the atexit array if malloc is not
98
      /* Don't dynamically allocate the atexit array if malloc is not
89
	 available.  */
99
	 available.  */
-
 
100
      if (!malloc)
-
 
101
	{
-
 
102
#ifndef __SINGLE_THREAD__
-
 
103
	  __lock_release_recursive(__atexit_lock);
90
      if (!malloc)
104
#endif
-
 
105
	  return -1;
Line 91... Line 106...
91
	return -1;
106
	}
92
 
107
 
93
      p = (struct _atexit *) malloc (sizeof *p);
108
      p = (struct _atexit *) malloc (sizeof *p);
94
      if (p == NULL)
109
      if (p == NULL)
Line 114... Line 129...
114
    {
129
    {
115
#ifdef _REENT_SMALL
130
#ifdef _REENT_SMALL
116
      args = p->_on_exit_args_ptr;
131
      args = p->_on_exit_args_ptr;
117
      if (args == NULL)
132
      if (args == NULL)
118
	{
133
	{
-
 
134
#ifndef _ATEXIT_DYNAMIC_ALLOC
-
 
135
#ifndef __SINGLE_THREAD__
-
 
136
	  __lock_release_recursive(__atexit_lock);
-
 
137
#endif
-
 
138
	  return -1;
-
 
139
#else
119
	  if (malloc)
140
	  if (malloc)
120
	    args = malloc (sizeof * p->_on_exit_args_ptr);
141
	    args = malloc (sizeof * p->_on_exit_args_ptr);
Line 121... Line 142...
121
 
142
 
122
	  if (args == NULL)
143
	  if (args == NULL)
Line 127... Line 148...
127
	      return -1;
148
	      return -1;
128
	    }
149
	    }
129
	  args->_fntypes = 0;
150
	  args->_fntypes = 0;
130
	  args->_is_cxa = 0;
151
	  args->_is_cxa = 0;
131
	  p->_on_exit_args_ptr = args;
152
	  p->_on_exit_args_ptr = args;
-
 
153
#endif
132
	}
154
	}
133
#else
155
#else
134
      args = &p->_on_exit_args;
156
      args = &p->_on_exit_args;
135
#endif
157
#endif
136
      args->_fnargs[p->_ind] = arg;
158
      args->_fnargs[p->_ind] = arg;