@@ -165,7 +165,7 @@ pub fn getpgrp() -> pid_t {
165
165
/// Get the caller's thread ID (see
166
166
/// [gettid(2)](http://man7.org/linux/man-pages/man2/gettid.2.html).
167
167
///
168
- /// This function is only available on Linux based systems. In a single
168
+ /// This implementation is only available on Linux based systems. In a single
169
169
/// threaded process, the main thread will have the same ID as the process. In
170
170
/// a multithreaded process, each thread will have a unique thread id but the
171
171
/// same process ID.
@@ -178,6 +178,15 @@ pub fn gettid() -> pid_t {
178
178
unsafe { libc:: syscall ( libc:: SYS_gettid ) as pid_t }
179
179
}
180
180
181
+ /// Get the caller's thread ID
182
+ /// This is the macos implementation
183
+ #[ cfg( target_os = "macos" ) ]
184
+ #[ inline]
185
+ pub fn gettid ( ) -> pid_t {
186
+ unsafe { libc:: pthread_self ( ) as pid_t }
187
+ }
188
+
189
+
181
190
/// Create a copy of the specified file descriptor (see
182
191
/// [dup(2)](http://man7.org/linux/man-pages/man2/dup.2.html)).
183
192
///
@@ -272,7 +281,7 @@ pub fn fchdir(dirfd: RawFd) -> Result<()> {
272
281
/// - the path already exists
273
282
/// - the path name is too long (longer than `PATH_MAX`, usually 4096 on linux, 1024 on OS X)
274
283
///
275
- /// For a full list consult
284
+ /// For a full list consult
276
285
/// [man mkdir(2)](http://man7.org/linux/man-pages/man2/mkdir.2.html#ERRORS)
277
286
///
278
287
/// # Example
0 commit comments