]> git.mxchange.org Git - flightgear.git/blob - 3rdparty/iaxclient/lib/winfuncs.c
VS2015 compatability fixes.
[flightgear.git] / 3rdparty / iaxclient / lib / winfuncs.c
1 /*
2  * iaxclient: a cross-platform IAX softphone library
3  *
4  * Copyrights:
5  * Copyright (C) 2003-2006, Horizon Wimba, Inc.
6  * Copyright (C) 2007, Wimba, Inc.
7  *
8  * Contributors:
9  * Steve Kann <stevek@stevek.com>
10  *
11  * This program is free software, distributed under the terms of
12  * the GNU Lesser (Library) General Public License.
13  */
14
15 #include "winpoop.h"    // include winsock2.h, windows.h, stdio.h, io.h
16 #include "iaxclient_lib.h"
17
18 void os_init(void)
19 {
20         WSADATA wsd;
21
22         if(WSAStartup(0x0101,&wsd))
23         {   // Error message?
24             exit(1);
25         }
26 }
27
28 /* yes, it could have just been a #define, but that makes linking trickier */
29 EXPORT void iaxc_millisleep(long ms)
30 {
31         Sleep(ms);
32 }
33
34 int iaxci_post_event_callback(iaxc_event ev) {
35         iaxc_event *e;
36         e = (iaxc_event *)malloc(sizeof(ev));
37         *e = ev;
38
39         if (!PostMessage((HWND)post_event_handle,post_event_id,(WPARAM) NULL, (LPARAM) e))
40                 free(e);
41         return 0;
42 }
43
44 /* Increasing the Thread Priority.  See
45  * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/scheduling_priorities.asp
46  * for discussion on Win32 scheduling priorities.
47  */
48
49 int iaxci_prioboostbegin() {
50     if ( !SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL)  ) {
51         fprintf(stderr, "SetThreadPriority failed: %ld.\n", GetLastError());
52     }
53     return 0;
54 }
55
56 int iaxci_prioboostend() {
57     /* TODO */
58     return 0;
59 }
60