File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ private BatchExportWorker<T> CreateWorker()
167167 {
168168#if NET
169169 // Use task-based worker for browser platform where threading may be limited
170- if ( OperatingSystem . IsBrowser ( ) || ! this . useThreads )
170+ if ( ThreadingHelper . IsThreadingDisabled ( ) || ! this . useThreads )
171171 {
172172 return new BatchExportTaskWorker < T > (
173173 this . circularBuffer ,
Original file line number Diff line number Diff line change 1+ // Copyright The OpenTelemetry Authors
2+ // SPDX-License-Identifier: Apache-2.0
3+
4+ namespace OpenTelemetry . Internal ;
5+
6+ internal class ThreadingHelper
7+ {
8+ internal static bool IsThreadingDisabled ( )
9+ {
10+ // if the threadpool isn't using threads assume they aren't enabled
11+ ThreadPool . GetMaxThreads ( out int workerThreads , out int completionPortThreads ) ;
12+
13+ return workerThreads == 1 && completionPortThreads == 1 ;
14+ }
15+ }
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ private PeriodicExportingMetricReaderWorker CreateWorker()
113113 {
114114#if NET
115115 // Use task-based worker for browser platform where threading may be limited
116- if ( OperatingSystem . IsBrowser ( ) || ! this . useThreads )
116+ if ( ThreadingHelper . IsThreadingDisabled ( ) || ! this . useThreads )
117117 {
118118 return new PeriodicExportingMetricReaderTaskWorker (
119119 this ,
You can’t perform that action at this time.
0 commit comments