Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions benchmark/string_decoder/string-decoder.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict';
const common = require('../common.js');
const StringDecoder = require('string_decoder').StringDecoder;
const assert = require('node:assert');

const bench = common.createBenchmark(main, {
encoding: ['ascii', 'utf8', 'base64-utf8', 'base64-ascii', 'utf16le'],
inLen: [32, 128, 1024, 4096],
chunkLen: [16, 64, 256, 1024],
inLen: [32, 128, 1024],
chunkLen: [16, 256, 1024],
n: [25e5],
});

Expand Down Expand Up @@ -75,10 +76,13 @@ function main({ encoding, inLen, chunkLen, n }) {

const nChunks = chunks.length;

let avoidDeadCode;
bench.start();
for (let i = 0; i < n; ++i) {
avoidDeadCode = '';
for (let j = 0; j < nChunks; ++j)
sd.write(chunks[j]);
avoidDeadCode += sd.write(chunks[j]);
}
bench.end(n);
assert.ok(avoidDeadCode);
}
9 changes: 5 additions & 4 deletions src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,11 @@ static int StartDebugSignalHandler() {
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &savemask));
sigmask = savemask;
pthread_t thread;
const int err = pthread_create(&thread, &attr,
StartIoThreadMain, nullptr);
// Restore original mask
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr));
const int err = pthread_create(&thread, &attr, StartIoThreadMain, nullptr);
CHECK_EQ(0, pthread_attr_destroy(&attr));
if (err != 0) {
// Restore original mask
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr));
fprintf(stderr, "node[%u]: pthread_create: %s\n",
uv_os_getpid(), strerror(err));
fflush(stderr);
Expand All @@ -137,6 +136,8 @@ static int StartDebugSignalHandler() {
return -err;
}
RegisterSignalHandler(SIGUSR1, StartIoThreadWakeup);
// Restore original mask
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr));
// Unblock SIGUSR1. A pending SIGUSR1 signal will now be delivered.
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGUSR1);
Expand Down
5 changes: 4 additions & 1 deletion src/node_watchdog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,10 @@ int SigintWatchdogHelper::Start() {
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &savemask));
sigmask = savemask;
int ret = pthread_create(&thread_, nullptr, RunSigintWatchdog, nullptr);
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr));

auto cleanup = OnScopeLeave(
[&]() { CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr)); });

if (ret != 0) {
return ret;
}
Expand Down
8 changes: 5 additions & 3 deletions tools/lint-readme-lists.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import assert from 'node:assert';
import { open } from 'node:fs/promises';
import { argv } from 'node:process';

const ghHandleLine = /^\* \[(.+)\]\(https:\/\/github\.com\/\1\) -$/;
const ghHandleLine = /^\* \[(.+)\]\(https:\/\/github\.com\/(.+)\) -$/;
const memberInfoLine = /^ {2}\*\*[^*]+\*\* <<[^@]+@.+\.[a-z]+>>( \(\w+(\/[^)/]+)+\))?( - \[Support me\]\(.+\))?$/;

const lists = {
Expand Down Expand Up @@ -59,9 +59,11 @@ for await (const line of readme.readLines()) {
);
}

if (!ghHandleLine.test(line)) {
throw new Error(`${currentGithubHandle} is not formatted correctly (README.md:${lineNumber})`);
const match = line.match(ghHandleLine);
if (!match) {
throw new Error(`${line} should match ${ghHandleLine} (README.md:${lineNumber})`);
}
assert.strictEqual(match[1], match[2], `GitHub handle does not match the URL (README.md:${lineNumber})`);

if (
currentList === 'TSC voting members' ||
Expand Down
Loading