Browse Source

Use getpid instead API_ThreadIdSelf function to create xid.

master
Jiaojinxing 7 years ago
parent
commit
ca85b3b7bd
  1. 11
      sunrpc/create_xid.c

11
sunrpc/create_xid.c

@ -22,7 +22,7 @@
#ifndef SYLIXOS
#include <libc-lock.h>
#endif
#include <kernrpc/rpc.h>
#include <rpc/rpc.h>
/* The RPC code is not threadsafe, but new code should be threadsafe. */
@ -33,11 +33,6 @@ static pid_t is_initialized;
static struct drand48_data __rpc_lrand48_data;
#endif
static int getktid (void)
{
return ((int)API_ThreadIdSelf() & 0xffff);
}
unsigned long
_create_xid (void)
{
@ -45,7 +40,7 @@ _create_xid (void)
__libc_lock_lock (createxid_lock);
pid_t pid = (pid_t)getktid ();
pid_t pid = getpid ();
if (is_initialized != pid)
{
struct timeval now;
@ -53,7 +48,7 @@ _create_xid (void)
__gettimeofday (&now, (struct timezone *) 0);
#ifndef SYLIXOS
__srand48_r (now.tv_sec ^ now.tv_usec ^ pid,
&__rpc_lrand48_data);
&__rpc_lrand48_data);
#else
srand48(now.tv_sec ^ now.tv_usec ^ pid);
#endif

Loading…
Cancel
Save