@@ -294,7 +294,6 @@ void __maps_free(struct Map *map) {
294
294
& __maps .freed , & tip , ABA (map , TAG (tip ) + 1 ), memory_order_release ,
295
295
memory_order_relaxed ))
296
296
break ;
297
- pthread_pause_np ();
298
297
}
299
298
}
300
299
@@ -462,8 +461,7 @@ textwindows dontinline static struct DirectMap sys_mmap_nt(
462
461
struct DirectMap dm ;
463
462
464
463
// 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 ) {
467
465
if (!(dm .addr = VirtualAlloc (addr , size , kNtMemReserve | kNtMemCommit ,
468
466
__prot2nt (prot , false)))) {
469
467
dm .addr = MAP_FAILED ;
@@ -579,13 +577,11 @@ static struct DirectMap sys_mmap(void *addr, size_t size, int prot, int flags,
579
577
struct Map * __maps_alloc (void ) {
580
578
struct Map * map ;
581
579
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 )))
583
581
if (atomic_compare_exchange_weak_explicit (
584
582
& __maps .freed , & tip , ABA (map -> freed , TAG (tip ) + 1 ),
585
583
memory_order_acquire , memory_order_relaxed ))
586
584
return map ;
587
- pthread_pause_np ();
588
- }
589
585
// we're creating sudden surprise memory. the user might be in the
590
586
// middle of carefully planning a fixed memory structure. we don't
591
587
// want the system allocator to put our surprise memory inside it,
@@ -595,8 +591,6 @@ struct Map *__maps_alloc(void) {
595
591
MAP_PRIVATE | MAP_ANONYMOUS , -1 , 0 );
596
592
if (sys .addr == MAP_FAILED )
597
593
return 0 ;
598
- if (IsWindows ())
599
- CloseHandle (sys .hand );
600
594
struct MapSlab * slab = sys .addr ;
601
595
while (!atomic_compare_exchange_weak (& __maps .slabs , & slab -> next , slab )) {
602
596
}
0 commit comments