Statistics for MySQL  1.1
 All Classes Files Functions Variables Typedefs Macros Pages
sqlthread.c
Go to the documentation of this file.
1 /* sqlthread.c (Threading) */
2 
3 /***********************************************************************
4 * This code is part of Statistics for MySQL.
5 *
6 * Copyright (C) 2011 Heinrich Schuchardt (xypron.glpk@gmx.de)
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 ***********************************************************************/
20 
27 #include "sqlthread.h"
28 #include <time.h>
29 
34 #ifdef SQLWIN
35 void sqlsleep(long msecs) {
36  Sleep((DWORD) msecs);
37 }
38 #else
39 void sqlsleep(long msecs) {
40  struct timespec ts;
41  ts.tv_sec = msecs / 1000;
42  ts.tv_nsec = 1000000 * (msecs % 1000);
43  nanosleep(&ts, NULL);
44 }
45 #endif
46 
Definitions needed for using threads and mutexes.
void sqlsleep(long msecs)
Let thread sleep.
Definition: sqlthread.c:39