File tree Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -1227,9 +1227,16 @@ changes:
12271227 used for generated code.
12281228 * ` stackSizeMb` {number} The default maximum stack size for the thread.
12291229 Small values may lead to unusable Worker instances. ** Default: ** ` 4` .
1230- * ` name` {string} An optional ` name` to be appended to the worker title
1231- for debugging/ identification purposes, making the final title as
1232- ` [worker ${ id} ] ${ name} ` . ** Default: ** ` ''` .
1230+ * ` name` {string} An optional ` name` to be replaced in the thread name
1231+ and to the worker title for debugging/ identification purposes,
1232+ making the final title as ` [worker ${ id} ] ${ name} ` .
1233+ This parameter has a maximum allowed size, depending on the operating
1234+ system . If the provided name exceeds the limit, it will be truncated
1235+ * Maximum sizes:
1236+ * Windows: 32 ,767 characters
1237+ * macOS: 64 characters
1238+ * Other systems: 16 characters
1239+ ** Default: ** ` 'WorkerThread'` .
12331240
12341241### Event : ` 'error'`
12351242
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ class Worker extends EventEmitter {
204204 options . env ) ;
205205 }
206206
207- let name = '' ;
207+ let name = 'WorkerThread ' ;
208208 if ( options . name ) {
209209 validateString ( options . name , 'options.name' ) ;
210210 name = StringPrototypeTrim ( options . name ) ;
Original file line number Diff line number Diff line change @@ -740,6 +740,7 @@ void Worker::StartThread(const FunctionCallbackInfo<Value>& args) {
740740 Worker* w = static_cast <Worker*>(arg);
741741 const uintptr_t stack_top = reinterpret_cast <uintptr_t >(&arg);
742742
743+ uv_thread_setname (w->name_ .c_str ());
743744 // Leave a few kilobytes just to make sure we're within limits and have
744745 // some space to do work in C++ land.
745746 w->stack_base_ = stack_top - (w->stack_size_ - kStackBufferSize );
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ if (isMainThread) {
2323 assert ( traces . length > 0 ) ;
2424 assert ( traces . some ( ( trace ) =>
2525 trace . cat === '__metadata' && trace . name === 'thread_name' &&
26- trace . args . name === '[worker 1]' ) ) ;
26+ trace . args . name === '[worker 1] WorkerThread ' ) ) ;
2727 } ) ) ;
2828 } ) ) ;
2929} else {
You can’t perform that action at this time.
0 commit comments