use libc::*;
use crate::deps::*;
use crate::flint::*;
#[repr(C)]
pub struct thread_pool_entry_struct {
pub pth: pthread_t,
pub mutex: pthread_mutex_t,
pub sleep1: pthread_cond_t,
pub sleep2: pthread_cond_t,
pub idx: libc::c_int,
pub available: libc::c_int,
pub max_workers: libc::c_int,
pub fxn: ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
pub fxnarg: *mut libc::c_void,
pub working: libc::c_int,
pub exit: libc::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of thread_pool_entry_struct"]
[::std::mem::size_of::<thread_pool_entry_struct>() - 184usize];
["Alignment of thread_pool_entry_struct"]
[::std::mem::align_of::<thread_pool_entry_struct>() - 8usize];
["Offset of field: thread_pool_entry_struct::pth"]
[::std::mem::offset_of!(thread_pool_entry_struct, pth) - 0usize];
["Offset of field: thread_pool_entry_struct::mutex"]
[::std::mem::offset_of!(thread_pool_entry_struct, mutex) - 8usize];
["Offset of field: thread_pool_entry_struct::sleep1"]
[::std::mem::offset_of!(thread_pool_entry_struct, sleep1) - 48usize];
["Offset of field: thread_pool_entry_struct::sleep2"]
[::std::mem::offset_of!(thread_pool_entry_struct, sleep2) - 96usize];
["Offset of field: thread_pool_entry_struct::idx"]
[::std::mem::offset_of!(thread_pool_entry_struct, idx) - 144usize];
["Offset of field: thread_pool_entry_struct::available"]
[::std::mem::offset_of!(thread_pool_entry_struct, available) - 148usize];
["Offset of field: thread_pool_entry_struct::max_workers"]
[::std::mem::offset_of!(thread_pool_entry_struct, max_workers) - 152usize];
["Offset of field: thread_pool_entry_struct::fxn"]
[::std::mem::offset_of!(thread_pool_entry_struct, fxn) - 160usize];
["Offset of field: thread_pool_entry_struct::fxnarg"]
[::std::mem::offset_of!(thread_pool_entry_struct, fxnarg) - 168usize];
["Offset of field: thread_pool_entry_struct::working"]
[::std::mem::offset_of!(thread_pool_entry_struct, working) - 176usize];
["Offset of field: thread_pool_entry_struct::exit"]
[::std::mem::offset_of!(thread_pool_entry_struct, exit) - 180usize];
};
impl Default for thread_pool_entry_struct {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
pub type thread_pool_entry_t = [thread_pool_entry_struct; 1usize];
#[repr(C)]
pub struct thread_pool_struct {
pub original_affinity: *mut libc::c_void,
pub mutex: pthread_mutex_t,
pub tdata: *mut thread_pool_entry_struct,
pub length: slong,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of thread_pool_struct"][::std::mem::size_of::<thread_pool_struct>() - 64usize];
["Alignment of thread_pool_struct"][::std::mem::align_of::<thread_pool_struct>() - 8usize];
["Offset of field: thread_pool_struct::original_affinity"]
[::std::mem::offset_of!(thread_pool_struct, original_affinity) - 0usize];
["Offset of field: thread_pool_struct::mutex"]
[::std::mem::offset_of!(thread_pool_struct, mutex) - 8usize];
["Offset of field: thread_pool_struct::tdata"]
[::std::mem::offset_of!(thread_pool_struct, tdata) - 48usize];
["Offset of field: thread_pool_struct::length"]
[::std::mem::offset_of!(thread_pool_struct, length) - 56usize];
};
impl Default for thread_pool_struct {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
pub type thread_pool_t = [thread_pool_struct; 1usize];
extern "C" {
pub static mut global_thread_pool: thread_pool_t;
pub static mut global_thread_pool_initialized: libc::c_int;
pub fn thread_pool_idle_loop(varg: *mut libc::c_void) -> *mut libc::c_void;
pub fn thread_pool_init(T: *mut thread_pool_struct, size: slong);
pub fn thread_pool_set_affinity(
T: *mut thread_pool_struct,
cpus: *mut libc::c_int,
length: slong,
) -> libc::c_int;
pub fn thread_pool_restore_affinity(T: *mut thread_pool_struct) -> libc::c_int;
pub fn thread_pool_get_size(T: *mut thread_pool_struct) -> slong;
pub fn thread_pool_set_size(T: *mut thread_pool_struct, new_size: slong) -> libc::c_int;
pub fn thread_pool_request(
T: *mut thread_pool_struct,
out: *mut thread_pool_handle,
requested: slong,
) -> slong;
pub fn thread_pool_wake(
T: *mut thread_pool_struct,
i: thread_pool_handle,
max_workers: libc::c_int,
f: ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
a: *mut libc::c_void,
);
pub fn thread_pool_wait(T: *mut thread_pool_struct, i: thread_pool_handle);
pub fn thread_pool_give_back(T: *mut thread_pool_struct, i: thread_pool_handle);
pub fn thread_pool_clear(T: *mut thread_pool_struct);
pub fn _thread_pool_distribute_work_2(
start: slong,
stop: slong,
Astart: *mut slong,
Astop: *mut slong,
Alen: slong,
Bstart: *mut slong,
Bstop: *mut slong,
UNUSED_Blen: slong,
);
pub fn _thread_pool_find_work_2(
a: ulong,
alpha: ulong,
b: ulong,
beta: ulong,
yn: ulong,
yd: ulong,
) -> ulong;
}