Subject: Re: get PID

From: Steffen Moeller <[email-masked]>
Date: Fri, 21 May 1999 09:34:18 +0100 (BST)

> > Is there a way to get the PID (process identification number)
> > in SWI prolog, as with the getpid() function in C ?
> > I need to create unique filenames; I considered tmp_file/2,
> > but these files are removed on exit.
> 
> No.  This will do:
> [...great example left out...] 

To remain platform independent you might choose to just add a rather
huge random number instead of choosing the PID, should be more secure
also:

?- X is random(2000000).

X = 464277 ;

No   

and mix it with the time if you like:
?- get_time(X),convert_time(X,Year,Month,Day,Hour,Minute,Second,MilliSeconds).

X = 9.27275e+08
Year = 1999
Month = 5
Day = 21
Hour = 9
Minute = 31
Second = 34
MilliSeconds = 16 ;

No 

Must admit that such long filenames don't really make you platform
independent either :)

Cheers,

Steffen

 --
    Steffen Moeller <[email-masked]>