| ... | @@ -2519,6 +2519,7 @@ pub const Thread = struct { | ... | @@ -2519,6 +2519,7 @@ pub const Thread = struct { |
| 2519 | | 2519 | |
| 2520 | /// Represents a kernel thread handle. | 2520 | /// Represents a kernel thread handle. |
| 2521 | /// May be an integer or a pointer depending on the platform. | 2521 | /// May be an integer or a pointer depending on the platform. |
| | 2522 | /// On Linux and POSIX, this is the same as Id. |
| 2522 | pub const Handle = if (use_pthreads) | 2523 | pub const Handle = if (use_pthreads) |
| 2523 | c.pthread_t | 2524 | c.pthread_t |
| 2524 | else switch (builtin.os) { | 2525 | else switch (builtin.os) { |
| ... | @@ -2557,6 +2558,7 @@ pub const Thread = struct { | ... | @@ -2557,6 +2558,7 @@ pub const Thread = struct { |
| 2557 | | 2558 | |
| 2558 | /// Returns the ID of the calling thread. | 2559 | /// Returns the ID of the calling thread. |
| 2559 | /// Makes a syscall every time the function is called. | 2560 | /// Makes a syscall every time the function is called. |
| | 2561 | /// On Linux and POSIX, this Id is the same as a Handle. |
| 2560 | pub fn getCurrentId() Id { | 2562 | pub fn getCurrentId() Id { |
| 2561 | if (use_pthreads) { | 2563 | if (use_pthreads) { |
| 2562 | return c.pthread_self(); | 2564 | return c.pthread_self(); |
| ... | @@ -2569,7 +2571,8 @@ pub const Thread = struct { | ... | @@ -2569,7 +2571,8 @@ pub const Thread = struct { |
| 2569 | } | 2571 | } |
| 2570 | | 2572 | |
| 2571 | /// Returns the handle of this thread. | 2573 | /// Returns the handle of this thread. |
| 2572 | pub fn handle(self: Thread) Thread.Handle { | 2574 | /// On Linux and POSIX, this is the same as Id. |
| | 2575 | pub fn handle(self: Thread) Handle { |
| 2573 | return self.data.handle; | 2576 | return self.data.handle; |
| 2574 | } | 2577 | } |
| 2575 | | 2578 | |