1use libc::*;
4use crate::deps::*;
5use crate::flint::*;
6
7
8#[repr(C)]
9pub struct thread_pool_entry_struct {
10 pub pth: pthread_t,
11 pub mutex: pthread_mutex_t,
12 pub sleep1: pthread_cond_t,
13 pub sleep2: pthread_cond_t,
14 pub idx: libc::c_int,
15 pub available: libc::c_int,
16 pub max_workers: libc::c_int,
17 pub fxn: ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
18 pub fxnarg: *mut libc::c_void,
19 pub working: libc::c_int,
20 pub exit: libc::c_int,
21}
22#[allow(clippy::unnecessary_operation, clippy::identity_op)]
23const _: () = {
24 ["Size of thread_pool_entry_struct"]
25 [::std::mem::size_of::<thread_pool_entry_struct>() - 184usize];
26 ["Alignment of thread_pool_entry_struct"]
27 [::std::mem::align_of::<thread_pool_entry_struct>() - 8usize];
28 ["Offset of field: thread_pool_entry_struct::pth"]
29 [::std::mem::offset_of!(thread_pool_entry_struct, pth) - 0usize];
30 ["Offset of field: thread_pool_entry_struct::mutex"]
31 [::std::mem::offset_of!(thread_pool_entry_struct, mutex) - 8usize];
32 ["Offset of field: thread_pool_entry_struct::sleep1"]
33 [::std::mem::offset_of!(thread_pool_entry_struct, sleep1) - 48usize];
34 ["Offset of field: thread_pool_entry_struct::sleep2"]
35 [::std::mem::offset_of!(thread_pool_entry_struct, sleep2) - 96usize];
36 ["Offset of field: thread_pool_entry_struct::idx"]
37 [::std::mem::offset_of!(thread_pool_entry_struct, idx) - 144usize];
38 ["Offset of field: thread_pool_entry_struct::available"]
39 [::std::mem::offset_of!(thread_pool_entry_struct, available) - 148usize];
40 ["Offset of field: thread_pool_entry_struct::max_workers"]
41 [::std::mem::offset_of!(thread_pool_entry_struct, max_workers) - 152usize];
42 ["Offset of field: thread_pool_entry_struct::fxn"]
43 [::std::mem::offset_of!(thread_pool_entry_struct, fxn) - 160usize];
44 ["Offset of field: thread_pool_entry_struct::fxnarg"]
45 [::std::mem::offset_of!(thread_pool_entry_struct, fxnarg) - 168usize];
46 ["Offset of field: thread_pool_entry_struct::working"]
47 [::std::mem::offset_of!(thread_pool_entry_struct, working) - 176usize];
48 ["Offset of field: thread_pool_entry_struct::exit"]
49 [::std::mem::offset_of!(thread_pool_entry_struct, exit) - 180usize];
50};
51impl Default for thread_pool_entry_struct {
52 fn default() -> Self {
53 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
54 unsafe {
55 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
56 s.assume_init()
57 }
58 }
59}
60pub type thread_pool_entry_t = [thread_pool_entry_struct; 1usize];
61#[repr(C)]
62pub struct thread_pool_struct {
63 pub original_affinity: *mut libc::c_void,
64 pub mutex: pthread_mutex_t,
65 pub tdata: *mut thread_pool_entry_struct,
66 pub length: slong,
67}
68#[allow(clippy::unnecessary_operation, clippy::identity_op)]
69const _: () = {
70 ["Size of thread_pool_struct"][::std::mem::size_of::<thread_pool_struct>() - 64usize];
71 ["Alignment of thread_pool_struct"][::std::mem::align_of::<thread_pool_struct>() - 8usize];
72 ["Offset of field: thread_pool_struct::original_affinity"]
73 [::std::mem::offset_of!(thread_pool_struct, original_affinity) - 0usize];
74 ["Offset of field: thread_pool_struct::mutex"]
75 [::std::mem::offset_of!(thread_pool_struct, mutex) - 8usize];
76 ["Offset of field: thread_pool_struct::tdata"]
77 [::std::mem::offset_of!(thread_pool_struct, tdata) - 48usize];
78 ["Offset of field: thread_pool_struct::length"]
79 [::std::mem::offset_of!(thread_pool_struct, length) - 56usize];
80};
81impl Default for thread_pool_struct {
82 fn default() -> Self {
83 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
84 unsafe {
85 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
86 s.assume_init()
87 }
88 }
89}
90pub type thread_pool_t = [thread_pool_struct; 1usize];
91extern "C" {
92 pub static mut global_thread_pool: thread_pool_t;
93 pub static mut global_thread_pool_initialized: libc::c_int;
94 pub fn thread_pool_idle_loop(varg: *mut libc::c_void) -> *mut libc::c_void;
95 pub fn thread_pool_init(T: *mut thread_pool_struct, size: slong);
96 pub fn thread_pool_set_affinity(
97 T: *mut thread_pool_struct,
98 cpus: *mut libc::c_int,
99 length: slong,
100 ) -> libc::c_int;
101 pub fn thread_pool_restore_affinity(T: *mut thread_pool_struct) -> libc::c_int;
102 pub fn thread_pool_get_size(T: *mut thread_pool_struct) -> slong;
103 pub fn thread_pool_set_size(T: *mut thread_pool_struct, new_size: slong) -> libc::c_int;
104 pub fn thread_pool_request(
105 T: *mut thread_pool_struct,
106 out: *mut thread_pool_handle,
107 requested: slong,
108 ) -> slong;
109 pub fn thread_pool_wake(
110 T: *mut thread_pool_struct,
111 i: thread_pool_handle,
112 max_workers: libc::c_int,
113 f: ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
114 a: *mut libc::c_void,
115 );
116 pub fn thread_pool_wait(T: *mut thread_pool_struct, i: thread_pool_handle);
117 pub fn thread_pool_give_back(T: *mut thread_pool_struct, i: thread_pool_handle);
118 pub fn thread_pool_clear(T: *mut thread_pool_struct);
119 pub fn _thread_pool_distribute_work_2(
120 start: slong,
121 stop: slong,
122 Astart: *mut slong,
123 Astop: *mut slong,
124 Alen: slong,
125 Bstart: *mut slong,
126 Bstop: *mut slong,
127 UNUSED_Blen: slong,
128 );
129 pub fn _thread_pool_find_work_2(
130 a: ulong,
131 alpha: ulong,
132 b: ulong,
133 beta: ulong,
134 yn: ulong,
135 yd: ulong,
136 ) -> ulong;
137}