Skip to content

Commit 53c6edf

Browse files
committed
Make correction to last change
1 parent 42a3bb7 commit 53c6edf

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

libc/intrin/mmap.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ void __maps_free(struct Map *map) {
294294
&__maps.freed, &tip, ABA(map, TAG(tip) + 1), memory_order_release,
295295
memory_order_relaxed))
296296
break;
297-
pthread_pause_np();
298297
}
299298
}
300299

@@ -462,8 +461,7 @@ textwindows dontinline static struct DirectMap sys_mmap_nt(
462461
struct DirectMap dm;
463462

464463
// it's 5x faster
465-
if (IsWindows() && (flags & MAP_ANONYMOUS) &&
466-
(flags & MAP_TYPE) != MAP_SHARED) {
464+
if ((flags & MAP_ANONYMOUS) && (flags & MAP_TYPE) != MAP_SHARED) {
467465
if (!(dm.addr = VirtualAlloc(addr, size, kNtMemReserve | kNtMemCommit,
468466
__prot2nt(prot, false)))) {
469467
dm.addr = MAP_FAILED;
@@ -579,13 +577,11 @@ static struct DirectMap sys_mmap(void *addr, size_t size, int prot, int flags,
579577
struct Map *__maps_alloc(void) {
580578
struct Map *map;
581579
uintptr_t tip = atomic_load_explicit(&__maps.freed, memory_order_relaxed);
582-
while ((map = (struct Map *)PTR(tip))) {
580+
while ((map = (struct Map *)PTR(tip)))
583581
if (atomic_compare_exchange_weak_explicit(
584582
&__maps.freed, &tip, ABA(map->freed, TAG(tip) + 1),
585583
memory_order_acquire, memory_order_relaxed))
586584
return map;
587-
pthread_pause_np();
588-
}
589585
// we're creating sudden surprise memory. the user might be in the
590586
// middle of carefully planning a fixed memory structure. we don't
591587
// want the system allocator to put our surprise memory inside it,
@@ -595,8 +591,6 @@ struct Map *__maps_alloc(void) {
595591
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
596592
if (sys.addr == MAP_FAILED)
597593
return 0;
598-
if (IsWindows())
599-
CloseHandle(sys.hand);
600594
struct MapSlab *slab = sys.addr;
601595
while (!atomic_compare_exchange_weak(&__maps.slabs, &slab->next, slab)) {
602596
}

tool/net/redbean.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3273,7 +3273,6 @@ static char *ServeIndex(const char *path, size_t pathlen) {
32733273
p = RoutePath(q, n);
32743274
free(q);
32753275
}
3276-
__print_maps(30);
32773276
return p;
32783277
}
32793278

0 commit comments

Comments
 (0)