equal
deleted
inserted
replaced
|
1 (* Title: Pure/ML/ml_pid.ML |
|
2 Author: Makarius |
|
3 |
|
4 Native PID for ML process. |
|
5 *) |
|
6 |
|
7 signature ML_PID = |
|
8 sig |
|
9 val get: unit -> int |
|
10 end; |
|
11 |
|
12 if ML_System.platform_is_windows then ML |
|
13 \<open> |
|
14 structure ML_PID: ML_PID = |
|
15 struct |
|
16 |
|
17 val get = |
|
18 Foreign.buildCall0 |
|
19 (Foreign.getSymbol (Foreign.loadLibrary "kernel32.dll") "GetCurrentProcessId", (), Foreign.cInt); |
|
20 |
|
21 end; |
|
22 \<close> |
|
23 else ML |
|
24 \<open> |
|
25 structure ML_PID: ML_PID = |
|
26 struct |
|
27 |
|
28 val get = Posix.ProcEnv.getpid #> Posix.Process.pidToWord #> SysWord.toLargeInt |
|
29 |
|
30 end; |
|
31 \<close> |