~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/os/os0thread.c

  • Committer: Brian Aker
  • Date: 2010-08-12 17:19:46 UTC
  • mfrom: (1701.1.1 turn-off-csv)
  • Revision ID: brian@tangent.org-20100812171946-n44naaqhg27gehlh
MErge Monty, remove CSV from auto-build

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1995, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
135
135
                              0,        /* thread runs immediately */
136
136
                              &win_thread_id);
137
137
 
 
138
        if (srv_set_thread_priorities) {
 
139
 
 
140
                /* Set created thread priority the same as a normal query
 
141
                in MYSQL: we try to prevent starvation of threads by
 
142
                assigning same priority QUERY_PRIOR to all */
 
143
 
 
144
                ut_a(SetThreadPriority(thread, srv_query_thread_priority));
 
145
        }
 
146
 
138
147
        if (thread_id) {
139
148
                *thread_id = win_thread_id;
140
149
        }
165
174
                exit(1);
166
175
        }
167
176
#endif
 
177
#ifdef __NETWARE__
 
178
        ret = pthread_attr_setstacksize(&attr,
 
179
                                        (size_t) NW_THD_STACKSIZE);
 
180
        if (ret) {
 
181
                fprintf(stderr,
 
182
                        "InnoDB: Error: pthread_attr_setstacksize"
 
183
                        " returned %d\n", ret);
 
184
                exit(1);
 
185
        }
 
186
#endif
168
187
        os_mutex_enter(os_sync_mutex);
169
188
        os_thread_count++;
170
189
        os_mutex_exit(os_sync_mutex);
183
202
#ifndef UNIV_HPUX10
184
203
        pthread_attr_destroy(&attr);
185
204
#endif
 
205
        if (srv_set_thread_priorities) {
 
206
 
 
207
                  struct sched_param tmp_sched_param;
 
208
 
 
209
                  memset(&tmp_sched_param, 0, sizeof(tmp_sched_param));
 
210
                  tmp_sched_param.sched_priority= srv_query_thread_priority;
 
211
                  (void)pthread_setschedparam(pthread, SCHED_OTHER, &tmp_sched_param);
 
212
        }
186
213
 
187
214
        if (thread_id) {
188
215
                *thread_id = pthread;
205
232
        fprintf(stderr, "Thread exits, id %lu\n",
206
233
                os_thread_pf(os_thread_get_curr_id()));
207
234
#endif
208
 
 
209
 
#ifdef UNIV_PFS_THREAD
210
 
        pfs_delete_thread();
211
 
#endif
212
 
 
213
235
        os_mutex_enter(os_sync_mutex);
214
236
        os_thread_count--;
215
237
        os_mutex_exit(os_sync_mutex);
217
239
#ifdef __WIN__
218
240
        ExitThread((DWORD)exit_value);
219
241
#else
220
 
        pthread_detach(pthread_self());
221
242
        pthread_exit(exit_value);
222
243
#endif
223
244
}
245
266
/*=================*/
246
267
{
247
268
#if defined(__WIN__)
248
 
        SwitchToThread();
 
269
        Sleep(0);
249
270
#elif (defined(HAVE_SCHED_YIELD) && defined(HAVE_SCHED_H))
250
271
        sched_yield();
251
272
#elif defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
268
289
{
269
290
#ifdef __WIN__
270
291
        Sleep((DWORD) tm / 1000);
 
292
#elif defined(__NETWARE__)
 
293
        delay(tm / 1000);
271
294
#else
272
295
        struct timeval  t;
273
296
 
315
338
ulint
316
339
os_thread_get_priority(
317
340
/*===================*/
318
 
        os_thread_t     /*handle __attribute__((unused))*/)
 
341
        os_thread_t     handle __attribute__((unused)))
319
342
                                /*!< in: OS handle to the thread */
320
343
{
321
344
#ifdef __WIN__