mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-29 16:52:28 +00:00
Fix ordering of pthread_create(pthread_t *thread)
This change fixes a bug where signal_latency_async_test would flake less than 1/1000 of the time. What was happening was pthread_kill(sender_thr) would return EFAULT. This was because pthread_create() was not returning the thread object pointer until after clone() had been called. So it was actually possible for the main thread to stall after calling clone() and during that time the receiver would launch and receive a signal from the sender thread, and then fail when it tried to send a pong. I thought I'd use a barrier at first, in the test, to synchronize thread creation, but I firmly believe that pthread_create() was to blame and now that's fixed
This commit is contained in:
parent
ed6d133a27
commit
e939659b70
6 changed files with 57 additions and 63 deletions
|
@ -6,17 +6,20 @@ import concurrent.futures
|
|||
from collections import Counter
|
||||
from typing import List, Dict, Tuple
|
||||
|
||||
NUM_PARALLEL = int(os.cpu_count() * 1.5)
|
||||
NUM_PARALLEL = int(os.cpu_count() * 20)
|
||||
|
||||
def find_test_files(root_dir: str) -> List[str]:
|
||||
def find_test_files(root: str) -> List[str]:
|
||||
"""Find all executable files ending with _test recursively."""
|
||||
test_files = []
|
||||
for root, _, files in os.walk(root_dir):
|
||||
for file in files:
|
||||
if file.endswith('_test'):
|
||||
file_path = os.path.join(root, file)
|
||||
if os.access(file_path, os.X_OK):
|
||||
test_files.append(file_path)
|
||||
if os.path.isdir(root):
|
||||
for root, _, files in os.walk(root):
|
||||
for file in files:
|
||||
if file.endswith('_test'):
|
||||
file_path = os.path.join(root, file)
|
||||
if os.access(file_path, os.X_OK):
|
||||
test_files.append(file_path)
|
||||
elif root.endswith('_test'):
|
||||
test_files.append(root)
|
||||
return test_files
|
||||
|
||||
def run_single_test(test_path: str) -> int:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue