File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -338,8 +338,17 @@ pub fn available_concurrency() -> io::Result<NonZeroUsize> {
338338 }
339339
340340 Ok ( unsafe { NonZeroUsize :: new_unchecked( cpus as usize ) } )
341+ } else if #[ cfg( target_os = "haiku" ) ] {
342+ let mut sinfo: libc:: system_info = crate :: mem:: zeroed( ) ;
343+ let res = libc:: get_system_info( & mut sinfo) ;
344+
345+ if res != libc:: B_OK {
346+ return Err ( io:: Error :: last_os_error( ) ) ;
347+ }
348+
349+ Ok ( unsafe { NonZeroUsize :: new_unchecked( sinfo. cpu_count as usize ) } )
341350 } else {
342- // FIXME: implement on vxWorks, Redox, Haiku, l4re
351+ // FIXME: implement on vxWorks, Redox, l4re
343352 Err ( io:: Error :: new_const( io:: ErrorKind :: Unsupported , & "Getting the number of hardware threads is not supported on the target platform" ) )
344353 }
345354 }
You can’t perform that action at this time.
0 commit comments