[plt-scheme] Re: current process id

From: David Van Horn (dvanhorn at cs.uvm.edu)
Date: Sat Feb 7 12:33:22 EST 2004

David J. Neu wrote:
> I thought I'd try to write an extension to get the current process id.
> Here's what I came up with by adapting one of the examples provided in
> the mzscheme distribution.  I've also included a test program.

You could save some typing using the C-FFI.

;; getpid.ss
(module getpid mzscheme
   (require (lib "cffi.ss" "compiler"))
   (provide getpid) ;; () -> integer
   (define getpid
     (c-lambda () int "getpid")))

mzc --auto-dir $PLTHOME/collects/getpid/getpid.ss
mzscheme -L getpid.ss getpid -e '(display (getpid))'

David



Posted on the users mailing list.