pthread: introduce pthread_setname_np() as a mean to give names to threads
... so that each cloned process at the kernel level can be named
independently. Tools like 'top' can display the CPU/memory statistics
for each process's thread if "Show Threads" mode is on.
With this function in place, we can convert dalvik/Thread.c setThreadName()
function over this function. This feature ought to be provided by the
underlying C library and not coded directly in Dalvik.
Change-Id: Ifa997665dbaa114e0b126f8c667708be9a4137fd
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index 1ada37e..73b7f41 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -185,6 +185,12 @@
extern pid_t tcgetpgrp(int fd);
extern int tcsetpgrp(int fd, pid_t _pid);
+#define TEMP_FAILURE_RETRY(expr) \
+ ({ long int __ret; \
+ do __ret = (long int)(expr); \
+ while (__ret == -1L && errno == EINTR); \
+ __ret; })
+
__END_DECLS
#endif /* _UNISTD_H_ */