Ticket #1564 (closed feature: done)

Opened 12 years ago

Last modified 11 years ago

expose a getpid library function for Rakudo $*PID and other languages

Reported by: mberends Owned by: NotFound
Priority: normal Milestone:
Component: core Version: trunk
Severity: medium Keywords: process ID pid getpid
Cc: Language: perl6
Patch status: Platform: all

Description

Please enable language implementations to read the ID of the running Parrot process. Coke++ implemented it in partcl with an "evil" workaround:

 http://github.com/partcl/partcl/blob/master/runtime/builtin/pid.pir

In Windows the lib should not be null, it should get the loadlib 'kernel32' result, and the function name is '_getpid' instead of 'getpid'.

The idea was discussed during about an hour from  http://irclog.perlgeek.de/parrot/2010-04-19#i_2242886

The Rakudo file src/cheats/setup-io.pm intends to use this function. In the meantime, it may get by with a workaround similar to the one in partcl.

Change History

Changed 11 years ago by NotFound

  • status changed from new to assigned
  • owner set to NotFound
  • type changed from feature to experimental

Function Parrot_getpid introduced as experimental in r48580

Changed 11 years ago by NotFound

Added a win32 version in 93f58ba1bd5c75763b5e193a6fc4444ca9115cc6

I've used GetCurrentProcessId, looks better than the evil workaround and I think it should work in the windows versions we support. Feedback welcome.

Changed 11 years ago by moritz

FYI, Rakudo now uses the getpid method from the parrot interpreter.

As soon as it's not "experimental" anymore, this ticket can be closed.

Changed 11 years ago by NotFound

After discussion on irc, the decision was to get out of experimental status both the Parrot_getpid function and the method getpid on Interpreter, making both supported.

When DEPRECATED.pod and other docs and comments get updated, I'm going to close this ticket.

Changed 11 years ago by NotFound

  • status changed from assigned to closed
  • type changed from experimental to feature
  • resolution set to done

Done in aaf8008, closing.

Note: See TracTickets for help on using tickets.