Misc: Trim and consolidate header file usage
[platform/upstream/libusb.git] / libusb / os / threads_posix.c
index ce14445..92bb11d 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <config.h>
+#include "libusbi.h"
 
-#include <time.h>
-#if defined(__linux__) || defined(__OpenBSD__)
+#if defined(__ANDROID__)
+# include <unistd.h>
+#elif defined(__linux__) || defined(__OpenBSD__)
 # if defined(__OpenBSD__)
 #  define _BSD_SOURCE
 # endif
-# include <unistd.h>
 # include <sys/syscall.h>
-#elif defined(__APPLE__)
-# include <mach/mach.h>
-#elif defined(__CYGWIN__)
-# include <windows.h>
 #endif
 
-#include "threads_posix.h"
-#include "libusbi.h"
-
 int usbi_cond_timedwait(pthread_cond_t *cond,
        pthread_mutex_t *mutex, const struct timeval *tv)
 {
@@ -69,8 +62,7 @@ int usbi_get_tid(void)
           real thread support. For 5.1 and earlier, -1 is returned. */
        ret = syscall(SYS_getthrid);
 #elif defined(__APPLE__)
-       ret = mach_thread_self();
-       mach_port_deallocate(mach_task_self(), ret);
+       ret = (int)pthread_mach_thread_np(pthread_self());
 #elif defined(__CYGWIN__)
        ret = GetCurrentThreadId();
 #else