kill and thisProcessID

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 24 05:02:16 PDT 2015


On 6/24/15 7:39 AM, "Nordlöw" wrote:
> I have a process that shall suspend itself using SIGTSTP or SIGSTOP.
>
> My current plan is
>
>      import std.process: thisProcessID, kill, Pid;
>      import core.sys.posix.signal: SIGKILL, SIGSTOP, SIGTSTP;
>      const thisPid = thisProcessID;
>      // some call to kill()
>
> but kill() needs a `Pid`
>
> so
>
>      kill(thisPid, SIGTSTP);
>
> fails and constructing Pid cannot be done because
>
>      kill(new Pid(thisPid), SIGTSTP);
>
> errors as
>
>      Error: class std.process.Pid member this is not accessible
>
> What to do?

Why not use core.sys.posix.signal: kill instead? You're already 
importing the module anyway.

-Steve



More information about the Digitalmars-d-learn mailing list