synccall: add separate exit_sem to fix thread release logic bug
[musl.git] / src / temp / __randname.c
blobe9b970f1f6360dbd7ea9f13ac9948cdf7825b1e5
1 #include <time.h>
2 #include <stdint.h>
3 #include "pthread_impl.h"
5 /* This assumes that a check for the
6 template size has already been made */
7 char *__randname(char *template)
9 int i;
10 struct timespec ts;
11 unsigned long r;
13 __clock_gettime(CLOCK_REALTIME, &ts);
14 r = ts.tv_sec + ts.tv_nsec + __pthread_self()->tid * 65537UL;
15 for (i=0; i<6; i++, r>>=5)
16 template[i] = 'A'+(r&15)+(r&16)*2;
18 return template;