mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
add ThreadPool (#926)
* lib/std/collections: fix tab indentation Signed-off-by: Pierre Curto <pierre.curto@gmail.com> * lib/std/threads: add ThreadPool Signed-off-by: Pierre Curto <pierre.curto@gmail.com> * ats/lib/threads: add num_cpu() Signed-off-by: Pierre Curto <pierre.curto@gmail.com> --------- Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
@@ -31,3 +31,5 @@ struct Stat
|
||||
}
|
||||
|
||||
extern fn int stat(ZString str, Stat* stat) @extern("stat64");
|
||||
|
||||
extern fn CInt sysctl(CInt *name, CUInt namelen, void *oldp, usz *oldlenp, void *newp, usz newlen);
|
||||
|
||||
@@ -57,3 +57,6 @@ struct Stat @if(!env::X86_64)
|
||||
}
|
||||
|
||||
extern fn CInt stat(ZString path, Stat* stat);
|
||||
|
||||
extern fn CInt get_nprocs();
|
||||
extern fn CInt get_nprocs_conf();
|
||||
|
||||
@@ -21,6 +21,28 @@ extern fn CFile _wfreopen(WString, WString, CFile);
|
||||
extern fn CInt _write(Fd fd, void* buffer, CUInt count);
|
||||
extern fn CInt _wremove(WString);
|
||||
|
||||
struct SystemInfo
|
||||
{
|
||||
union {
|
||||
uint dwOemId;
|
||||
struct {
|
||||
ushort wProcessorArchitecture;
|
||||
ushort wReserved;
|
||||
}
|
||||
}
|
||||
uint dwPageSize;
|
||||
void* lpMinimumApplicationAddress;
|
||||
void* lpMaximumApplicationAddress;
|
||||
usz dwActiveProcessorMask;
|
||||
uint dwNumberOfProcessors;
|
||||
uint dwProcessorType;
|
||||
uint dwAllocationGranularity;
|
||||
ushort wProcessorLevel;
|
||||
ushort wProcessorRevision;
|
||||
}
|
||||
|
||||
extern fn CInt get_system_info(SystemInfo*) @extern("GetSystemInfo");
|
||||
|
||||
// Aliases to simplify libc use
|
||||
macro Tm* localtime_r(Time_t* timer, Tm* buf) => _localtime64_s(buf, timer);
|
||||
macro CInt setjmp(JmpBuf* buffer) => _setjmp($$frameaddress(), buffer);
|
||||
|
||||
Reference in New Issue
Block a user