+static int vg_thread_run( void *pfunc, void *data );
+static void vg_thread_exit(void);
+static void vg_set_thread_name( const char *name );
+static int vg_semaphore_init( vg_semaphore *sem, u32 value );
+static int vg_semaphore_trywait( vg_semaphore *sem );
+static int vg_semaphore_wait( vg_semaphore *sem );
+static int vg_semaphore_post( vg_semaphore *sem );
+static void vg_semaphore_free( vg_semaphore *sem );
+static int vg_mutex_init( vg_mutex *mutex );
+static int vg_mutex_lock( vg_mutex *mutex );
+static int vg_mutex_unlock( vg_mutex *mutex );
+static void vg_mutex_free( vg_mutex *mutex );
+static void vg_sleep_ms( long msec );
+static double vg_time_diff( vg_timespec start, vg_timespec end );
+
+#ifdef _WIN32_NO
+
+static int vg_thread_run( void *pfunc, void *data )
+{
+ HANDLE hThread = CreateThread
+ (
+ NULL, /* Thread attributes */
+ 0, /* Stack size (0 = use default) */
+ pfunc, /* Thread start address */
+ data, /* Parameter to pass to the thread */
+ 0, /* Creation flags */
+ NULL /* Thread id */
+ );
+
+ if ( hThread == NULL )
+ {
+ /*
+ * Thread creation failed.
+ * More details can be retrieved by calling GetLastError()
+ */
+ return 1;
+ }
+ else
+ {
+ CloseHandle( hThread );
+ return 0;
+ }
+}
+
+static void vg_thread_exit(void)
+{
+ ExitThread(0);
+}
+
+static void vg_set_thread_name( const char *name )
+{
+ /* I believe this is a meaningless concept in windows */
+}
+
+static int vg_semaphore_init( vg_semaphore *sem, u32 value );
+static int vg_semaphore_trywait( vg_semaphore *sem );
+static int vg_semaphore_wait( vg_semaphore *sem );
+static int vg_semaphore_post( vg_semaphore *sem );
+static void vg_semaphore_free( vg_semaphore *sem );
+static int vg_mutex_init( vg_mutex *mutex );
+static int vg_mutex_lock( vg_mutex *mutex );
+static int vg_mutex_unlock( vg_mutex *mutex );
+static void vg_mutex_free( vg_mutex *mutex );
+static void vg_sleep_ms( long msec );
+static double vg_time_diff( vg_timespec start, vg_timespec end );
+