mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Fix fork thread handle leak on windows
This commit is contained in:
parent
a15958edc6
commit
538ce338f4
3 changed files with 3 additions and 4 deletions
|
@ -24,7 +24,6 @@
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/describebacktrace.h"
|
#include "libc/intrin/describebacktrace.h"
|
||||||
#include "libc/intrin/dll.h"
|
#include "libc/intrin/dll.h"
|
||||||
#include "libc/intrin/kprintf.h"
|
|
||||||
#include "libc/intrin/maps.h"
|
#include "libc/intrin/maps.h"
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
#include "libc/nexgen32e/rdtsc.h"
|
#include "libc/nexgen32e/rdtsc.h"
|
||||||
|
@ -92,7 +91,7 @@ void __maps_init(void) {
|
||||||
// https://lwn.net/Articles/725832/. if we guess too small, then
|
// https://lwn.net/Articles/725832/. if we guess too small, then
|
||||||
// slackmap will create a bunch of zombie stacks in __print_maps
|
// slackmap will create a bunch of zombie stacks in __print_maps
|
||||||
// to coverup the undisclosed memory but no cost if we guess big
|
// to coverup the undisclosed memory but no cost if we guess big
|
||||||
size_t guardsize = (__maps.rand % 8 + 1) * 1000 * 1024;
|
size_t guardsize = 1024 * 1024;
|
||||||
guardsize += __pagesize - 1;
|
guardsize += __pagesize - 1;
|
||||||
guardsize &= -__pagesize;
|
guardsize &= -__pagesize;
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ textwindows static errno_t CloneWindows(int (*func)(void *), char *stk,
|
||||||
wt->arg = arg;
|
wt->arg = arg;
|
||||||
wt->tls = tls;
|
wt->tls = tls;
|
||||||
wt->sp = tip & -16;
|
wt->sp = tip & -16;
|
||||||
if ((h = CreateThread(&kNtIsInheritable, 65536, (void *)WinThreadEntry, wt,
|
if ((h = CreateThread(0, 65536, (void *)WinThreadEntry, wt,
|
||||||
kNtStackSizeParamIsAReservation, &utid))) {
|
kNtStackSizeParamIsAReservation, &utid))) {
|
||||||
atomic_init(ptid, utid);
|
atomic_init(ptid, utid);
|
||||||
struct CosmoTib *tib = tls;
|
struct CosmoTib *tib = tls;
|
||||||
|
|
|
@ -71,7 +71,7 @@ static void _print_benchmark_result(double total_nanos, double work_per_run,
|
||||||
work_unit = " ";
|
work_unit = " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%8.2f %-2s %8.2f %s/s %6.2f %s %2dx %s\n", time_value, time_unit,
|
printf("%8.2f %-2s %8.2f %s/s %6.2f %s %3dx %s\n", time_value, time_unit,
|
||||||
throughput, throughput_unit, work_per_run, work_unit, iterations,
|
throughput, throughput_unit, work_per_run, work_unit, iterations,
|
||||||
code);
|
code);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue