+void Sleep(const long ms)\r
+{\r
+ pthread_cond_t c;\r
+ pthread_mutex_t m;\r
+ timespec t;\r
+ timeb tb;\r
+\r
+ pthread_mutex_init(&m,NULL);\r
+ pthread_cond_init(&c,NULL);\r
+\r
+ ftime(&tb);\r
+\r
+ t.tv_sec=tb.time+(ms/1000);\r
+ t.tv_nsec=((1000000L)*(long)tb.millitm)+((1000000L)*(ms%1000));\r
+\r
+ pthread_mutex_lock(&m);\r
+ pthread_cond_timedwait(&c,&m,&t);\r
+ pthread_mutex_unlock(&m);\r
+\r
+ pthread_cond_destroy(&c);\r
+ pthread_mutex_destroy(&m);\r
+}\r
+\r