00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "iaxclient_lib.h"
00016
00017 #include <windows.h>
00018 #include <winbase.h>
00019
00020 #include <stdio.h>
00021
00022 #if !defined(_WIN32_WCE)
00023 #include <sys/timeb.h>
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 void gettimeofday( struct timeval* tv, void* tz )
00040 {
00041 struct _timeb curSysTime;
00042
00043 _ftime(&curSysTime);
00044 tv->tv_sec = (long)curSysTime.time;
00045 tv->tv_usec = curSysTime.millitm * 1000;
00046 }
00047 #endif
00048
00049 void os_init(void)
00050 {
00051 WSADATA wsd;
00052
00053 if(WSAStartup(0x0101,&wsd))
00054 {
00055 exit(1);
00056 }
00057 }
00058
00059
00060 EXPORT void iaxc_millisleep(long ms)
00061 {
00062 Sleep(ms);
00063 }
00064
00065 int iaxci_post_event_callback(iaxc_event ev) {
00066 iaxc_event *e;
00067 e = (iaxc_event *)malloc(sizeof(ev));
00068 *e = ev;
00069
00070 if (!PostMessage((HWND)post_event_handle,post_event_id,(WPARAM) NULL, (LPARAM) e))
00071 free(e);
00072 return 0;
00073 }
00074
00075
00076
00077
00078
00079
00080 int iaxci_prioboostbegin() {
00081 if ( !SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL) ) {
00082 fprintf(stderr, "SetThreadPriority failed: %ld.\n", GetLastError());
00083 }
00084 return 0;
00085 }
00086
00087 int iaxci_prioboostend() {
00088
00089 return 0;
00090 }
00091