equal
deleted
inserted
replaced
3580 |
3580 |
3581 %{ /* NOCONTEXT */ |
3581 %{ /* NOCONTEXT */ |
3582 int pid; |
3582 int pid; |
3583 |
3583 |
3584 pid = fork(); |
3584 pid = fork(); |
|
3585 if (pid == 0) { |
|
3586 // pid is no longer valid in subprocess - reset the cached pid |
|
3587 @global(MyPid) = nil; |
|
3588 } |
3585 RETURN ( __MKUINT(pid) ); |
3589 RETURN ( __MKUINT(pid) ); |
3586 %}. |
3590 %}. |
3587 "/ |
3591 "/ |
3588 "/ not supported by OS |
3592 "/ not supported by OS |
3589 "/ |
3593 "/ |
3593 |id t1 t2 t3| |
3597 |id t1 t2 t3| |
3594 |
3598 |
3595 t1 := Timestamp now. |
3599 t1 := Timestamp now. |
3596 id := OperatingSystem fork. |
3600 id := OperatingSystem fork. |
3597 id == 0 ifTrue:[ |
3601 id == 0 ifTrue:[ |
3598 'Child t=' print. (Timestamp now - t1) printCR. |
3602 'Child t=' print. (Timestamp now - t1) printCR. |
3599 'I am the child process' printCR. |
3603 'I am the child process' printCR. |
3600 OperatingSystem exit |
3604 OperatingSystem exit |
3601 ]. |
3605 ]. |
3602 'Parent t=' print. (Timestamp now - t1) printCR. |
3606 'Parent t=' print. (Timestamp now - t1) printCR. |
3603 " |
3607 " |
|
3608 |
|
3609 "Modified: / 16-04-2020 / 16:48:30 / Stefan Vogel" |
3604 ! ! |
3610 ! ! |
3605 |
3611 |
3606 !UnixOperatingSystem class methodsFor:'executing OS commands-queries'! |
3612 !UnixOperatingSystem class methodsFor:'executing OS commands-queries'! |
3607 |
3613 |
3608 commandAndArgsForOSCommand:aCommandStringOrArray |
3614 commandAndArgsForOSCommand:aCommandStringOrArray |
8306 |
8312 |
8307 getProcessId |
8313 getProcessId |
8308 "return the (unix-)processId" |
8314 "return the (unix-)processId" |
8309 |
8315 |
8310 %{ /* NOCONTEXT */ |
8316 %{ /* NOCONTEXT */ |
8311 RETURN ( __mkSmallInteger(getpid()) ); |
8317 if (@global(MyPid) == nil) { |
|
8318 @global(MyPid) = __mkSmallInteger(getpid()); |
|
8319 } |
|
8320 RETURN(@global(MyPid)); |
8312 %} |
8321 %} |
8313 " |
8322 " |
8314 OperatingSystem getProcessId |
8323 OperatingSystem getProcessId |
8315 " |
8324 " |
|
8325 |
|
8326 "Modified: / 16-04-2020 / 16:54:06 / Stefan Vogel" |
8316 ! |
8327 ! |
8317 |
8328 |
8318 getSystemID |
8329 getSystemID |
8319 "if supported by the OS, return the systemID; |
8330 "if supported by the OS, return the systemID; |
8320 a unique per machine identification. |
8331 a unique per machine identification. |