[plt-scheme] getpid

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Mar 28 15:47:58 EST 2005

At Mon, 28 Mar 2005 15:02:48 -0500, "David J. Neu" wrote:
> Would it be possible to have a getpid procedure, that would return the
> process id, included with mzscheme?  I've written a (one procedure)
> mzscheme extension, but I'd prefer not have to carry around and manage
> the installation of the C code.

David beat me to it, but FWIW, here's a version that works with

(module getpid mzscheme
  (require (lib "foreign.ss")) (unsafe!)
  (provide getpid)
  (define getpid
    (if (eq? (system-type) 'windows)
	(get-ffi-obj "GetCurrentProcessId" (ffi-lib "kernel32") (_fun -> _int))
	(get-ffi-obj "getpid" #f (_fun -> _int)))))


Posted on the users mailing list.