Loading adb/commandline.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -403,7 +403,6 @@ static void *stdin_read_thread(void *x) } static int interactive_shell() { adb_thread_t thr; int fdi; std::string error; Loading @@ -424,7 +423,8 @@ static int interactive_shell() { fds[1] = fdi; stdin_raw_init(fdi); adb_thread_create(&thr, stdin_read_thread, fds); adb_thread_create(stdin_read_thread, fds); read_and_dump(fd); stdin_raw_restore(fdi); return 0; Loading adb/services.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -210,8 +210,7 @@ static int create_service_thread(void (*func)(int, void *), void *cookie) sti->cookie = cookie; sti->fd = s[1]; adb_thread_t t; if (adb_thread_create(&t, service_bootstrap_func, sti)) { if (!adb_thread_create(service_bootstrap_func, sti)) { free(sti); adb_close(s[0]); adb_close(s[1]); Loading Loading @@ -401,8 +400,7 @@ static int create_subproc_thread(const char *name, bool pty = false) { sti->cookie = (void*) (uintptr_t) pid; sti->fd = ret_fd; adb_thread_t t; if (adb_thread_create(&t, service_bootstrap_func, sti)) { if (!adb_thread_create(service_bootstrap_func, sti)) { free(sti); adb_close(ret_fd); fprintf(stderr, "cannot create service thread\n"); Loading adb/sysdeps.h +10 −18 Original line number Diff line number Diff line Loading @@ -79,19 +79,13 @@ static __inline__ void adb_mutex_unlock( adb_mutex_t* lock ) LeaveCriticalSection( lock ); } typedef struct { unsigned tid; } adb_thread_t; typedef void* (*adb_thread_func_t)(void* arg); typedef void (*win_thread_func_t)(void* arg); static __inline__ int adb_thread_create( adb_thread_t *thread, adb_thread_func_t func, void* arg) { thread->tid = _beginthread( (win_thread_func_t)func, 0, arg ); if (thread->tid == (unsigned)-1L) { return -1; } return 0; static __inline__ bool adb_thread_create(adb_thread_func_t func, void* arg) { unsigned tid = _beginthread( (win_thread_func_t)func, 0, arg ); return (tid != (unsigned)-1L); } static __inline__ unsigned long adb_thread_id() Loading Loading @@ -429,18 +423,16 @@ static __inline__ int adb_socket_accept(int serverfd, struct sockaddr* addr, #define unix_write adb_write #define unix_close adb_close typedef pthread_t adb_thread_t; typedef void* (*adb_thread_func_t)( void* arg ); static __inline__ int adb_thread_create( adb_thread_t *pthread, adb_thread_func_t start, void* arg ) { static __inline__ bool adb_thread_create(adb_thread_func_t start, void* arg) { pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); return pthread_create( pthread, &attr, start, arg ); pthread_t thread; errno = pthread_create(&thread, &attr, start, arg); return (errno == 0); } static __inline__ int adb_socket_setbufsize( int fd, int bufsize ) Loading adb/transport.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -530,8 +530,6 @@ transport_write_action(int fd, struct tmsg* m) static void transport_registration_func(int _fd, unsigned ev, void *data) { tmsg m; adb_thread_t output_thread_ptr; adb_thread_t input_thread_ptr; int s[2]; atransport *t; Loading Loading @@ -600,11 +598,11 @@ static void transport_registration_func(int _fd, unsigned ev, void *data) fdevent_set(&(t->transport_fde), FDE_READ); if(adb_thread_create(&input_thread_ptr, input_thread, t)){ if (!adb_thread_create(input_thread, t)) { fatal_errno("cannot create input thread"); } if(adb_thread_create(&output_thread_ptr, output_thread, t)){ if (!adb_thread_create(output_thread, t)) { fatal_errno("cannot create output thread"); } } Loading adb/transport_local.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -234,9 +234,8 @@ static const char _ok_resp[] = "ok"; if (fd < 0) { /* This could be an older version of the emulator, that doesn't * implement adb QEMUD service. Fall back to the old TCP way. */ adb_thread_t thr; D("adb service is not available. Falling back to TCP socket.\n"); adb_thread_create(&thr, server_socket_thread, arg); adb_thread_create(server_socket_thread, arg); return 0; } Loading Loading @@ -279,7 +278,6 @@ static const char _ok_resp[] = "ok"; void local_init(int port) { adb_thread_t thr; void* (*func)(void *); if(HOST) { Loading @@ -304,9 +302,8 @@ void local_init(int port) D("transport: local %s init\n", HOST ? "client" : "server"); if(adb_thread_create(&thr, func, (void *) (uintptr_t) port)) { fatal_errno("cannot create local socket %s thread", HOST ? "client" : "server"); if (!adb_thread_create(func, (void *) (uintptr_t) port)) { fatal_errno("cannot create local socket %s thread", HOST ? "client" : "server"); } } Loading Loading
adb/commandline.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -403,7 +403,6 @@ static void *stdin_read_thread(void *x) } static int interactive_shell() { adb_thread_t thr; int fdi; std::string error; Loading @@ -424,7 +423,8 @@ static int interactive_shell() { fds[1] = fdi; stdin_raw_init(fdi); adb_thread_create(&thr, stdin_read_thread, fds); adb_thread_create(stdin_read_thread, fds); read_and_dump(fd); stdin_raw_restore(fdi); return 0; Loading
adb/services.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -210,8 +210,7 @@ static int create_service_thread(void (*func)(int, void *), void *cookie) sti->cookie = cookie; sti->fd = s[1]; adb_thread_t t; if (adb_thread_create(&t, service_bootstrap_func, sti)) { if (!adb_thread_create(service_bootstrap_func, sti)) { free(sti); adb_close(s[0]); adb_close(s[1]); Loading Loading @@ -401,8 +400,7 @@ static int create_subproc_thread(const char *name, bool pty = false) { sti->cookie = (void*) (uintptr_t) pid; sti->fd = ret_fd; adb_thread_t t; if (adb_thread_create(&t, service_bootstrap_func, sti)) { if (!adb_thread_create(service_bootstrap_func, sti)) { free(sti); adb_close(ret_fd); fprintf(stderr, "cannot create service thread\n"); Loading
adb/sysdeps.h +10 −18 Original line number Diff line number Diff line Loading @@ -79,19 +79,13 @@ static __inline__ void adb_mutex_unlock( adb_mutex_t* lock ) LeaveCriticalSection( lock ); } typedef struct { unsigned tid; } adb_thread_t; typedef void* (*adb_thread_func_t)(void* arg); typedef void (*win_thread_func_t)(void* arg); static __inline__ int adb_thread_create( adb_thread_t *thread, adb_thread_func_t func, void* arg) { thread->tid = _beginthread( (win_thread_func_t)func, 0, arg ); if (thread->tid == (unsigned)-1L) { return -1; } return 0; static __inline__ bool adb_thread_create(adb_thread_func_t func, void* arg) { unsigned tid = _beginthread( (win_thread_func_t)func, 0, arg ); return (tid != (unsigned)-1L); } static __inline__ unsigned long adb_thread_id() Loading Loading @@ -429,18 +423,16 @@ static __inline__ int adb_socket_accept(int serverfd, struct sockaddr* addr, #define unix_write adb_write #define unix_close adb_close typedef pthread_t adb_thread_t; typedef void* (*adb_thread_func_t)( void* arg ); static __inline__ int adb_thread_create( adb_thread_t *pthread, adb_thread_func_t start, void* arg ) { static __inline__ bool adb_thread_create(adb_thread_func_t start, void* arg) { pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); return pthread_create( pthread, &attr, start, arg ); pthread_t thread; errno = pthread_create(&thread, &attr, start, arg); return (errno == 0); } static __inline__ int adb_socket_setbufsize( int fd, int bufsize ) Loading
adb/transport.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -530,8 +530,6 @@ transport_write_action(int fd, struct tmsg* m) static void transport_registration_func(int _fd, unsigned ev, void *data) { tmsg m; adb_thread_t output_thread_ptr; adb_thread_t input_thread_ptr; int s[2]; atransport *t; Loading Loading @@ -600,11 +598,11 @@ static void transport_registration_func(int _fd, unsigned ev, void *data) fdevent_set(&(t->transport_fde), FDE_READ); if(adb_thread_create(&input_thread_ptr, input_thread, t)){ if (!adb_thread_create(input_thread, t)) { fatal_errno("cannot create input thread"); } if(adb_thread_create(&output_thread_ptr, output_thread, t)){ if (!adb_thread_create(output_thread, t)) { fatal_errno("cannot create output thread"); } } Loading
adb/transport_local.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -234,9 +234,8 @@ static const char _ok_resp[] = "ok"; if (fd < 0) { /* This could be an older version of the emulator, that doesn't * implement adb QEMUD service. Fall back to the old TCP way. */ adb_thread_t thr; D("adb service is not available. Falling back to TCP socket.\n"); adb_thread_create(&thr, server_socket_thread, arg); adb_thread_create(server_socket_thread, arg); return 0; } Loading Loading @@ -279,7 +278,6 @@ static const char _ok_resp[] = "ok"; void local_init(int port) { adb_thread_t thr; void* (*func)(void *); if(HOST) { Loading @@ -304,9 +302,8 @@ void local_init(int port) D("transport: local %s init\n", HOST ? "client" : "server"); if(adb_thread_create(&thr, func, (void *) (uintptr_t) port)) { fatal_errno("cannot create local socket %s thread", HOST ? "client" : "server"); if (!adb_thread_create(func, (void *) (uintptr_t) port)) { fatal_errno("cannot create local socket %s thread", HOST ? "client" : "server"); } } Loading