summaryrefslogtreecommitdiff
path: root/src/System.Private.CoreLib/src/System/Threading
AgeCommit message (Collapse)AuthorFilesLines
2019-07-28Fix nullability annotations for static (#25914)Stephen Toub1-2/+1
The compiler is now analyzing statics. Get compliant.
2019-06-26Tweak nullable attribute per API review (#25443)Stephen Toub1-2/+2
2019-06-19Address nullable feedback for S.T.Overlapped, S.Memory, S.R.InteropServices ↵Santiago Fernandez Madero1-2/+2
(#25214) * Address nullable feedback for System.Threading.Overlapped * Address nullable feedback for System.Memory * Address nullable for System.Runtime.InteropServices * Update xml comments and make CultureInfo nullable to match String.ToLower/Upper feedback * PR feedback: revert accepting null comparer in BinarySearch * Disable test that needs to be updated in corefx
2019-06-05Less work for OptimalMaxSpinWaitsPerSpinIteration fast-path (#21702)Ben Adams1-11/+13
2019-05-28Add and apply nullable attributes (#24679)Stephen Toub3-5/+10
* Add and apply nullable attributes * Adapt to API review decisions * Address PR feedback
2019-05-24Update BuildTools, CoreClr to preview4-04022-01, preview6-27721-71, ↵dotnet-maestro-bot2-3/+3
respectively (master) (#24369) * Update BuildTools, CoreClr to preview4-04022-01, preview6-27721-71, respectively * Use `Nullable=enable` rather than `NullableContextOptions=enable` * Resolving new nullability warnings * PR Feedback
2019-05-23Fewer ilstubs in corelib from reflection apis (#24708)David Wrighton2-3/+3
Rework use of marshalling for RuntimeTypeHandle, RuntimeModule, RuntimeAssembly, and IRuntimeMethodInfo as used by QCalls - Remove special QCall only used marshallers for RuntimeAssembly, RuntimeModule and IRuntimeMethodInfo - Following the pattern of ObjectHandleOnStack, implement QCall handle types for RuntimeAssembly/Module/TypeHandle. Use these in all QCalls that once passed the types directly. - For uses of IRuntimeMethodInfo, follow the existing RuntimeMethodHandleInternal pattern Also perform some replacement of bool marshalling with use of Interop.BOOL, and a few cases of using pointers instead of byref arguments. Fix delivers a relatively small win on startup, and small throughput gains around reflection as IL stubs are no longer necessary for many functions in reflection that once needed them. Reduces methods jitted on powershell startup from 422 to 399, (About 5%) but performance win is only about 5ms on ~400ms as the methods removed are simple.
2019-05-14Fix a contract violation in ThreadPool.get_CompletedWorkItemCount (#24535)Koundinya Veluri2-10/+9
Fix a contract violation in ThreadPool.get_CompletedWorkItemCount Fixes https://github.com/dotnet/coreclr/issues/24515 - Looks like the path that acquires the thread store lock has code that is marked witH GC_TRIGGERS - Changed ThreadPool.get_CompletedWorkItemCount and Monitor.get_LockContentionCount to use QCalls instead of FCalls
2019-05-09Turn on nullability for all of Corelib (#24497)Stephen Toub17-17/+0
* Enable nullable at the project level * Remove `#nullable enable` from individual files Removes `#nullable enable` from almost all .cs files in System.Private.CoreLib. I left it only in the ~30 files (out of ~1480 that had it) that are mirrored to corefx, that are built into projects by corefx that don't yet set NullableContextOptions at the project level, and that use nullable annotations; otherwise, they'd break the corefx build.
2019-04-27Nullable for Type class (#23489)buyaa-n1-2/+2
System.Type, System.Reflection nullability
2019-04-23Fix handling of negative numbers in ThreadPool.SetMin/MaxThreads (#24163)Stephen Toub1-2/+8
* Fix handling of negative numbers in ThreadPool.SetMin/MaxThreads * Fix disabled test name
2019-04-19Implement APIs for some threading metrics (CoreCLR) (#24113)Koundinya Veluri2-0/+39
Implement APIs for some threading metrics (CoreCLR) API review: https://github.com/dotnet/corefx/issues/35500
2019-04-13Delete COMPlus_FinalizeOnShutdown (#23595)Jan Kotas1-6/+1
This compat quirk is increasingly more broken since the framework is generally not compatible with, and we have not heard anybody actually using it. Changed Environment.HasShutdownStarted to unconditionally return false. It does not make sense for it to ever return true with shutdown finalization disabled.
2019-04-10Move TimerQueue.TickCount Windows implementation to shared CoreLib (#23838)Filip Navara1-31/+0
2019-04-03Nullable: System.Threading.Tasks (#23691)Stephen Toub2-9/+3
* Nullable: System.Threading.Tasks * Address PR feedback
2019-04-02Nullable: System.Threading (#23663)Stephen Toub3-26/+37
Finishes off annotation of the System.Threading namespace, not including subnamespaces.
2019-04-02Nullable: Interlocked, Volatile (#23655)Stephen Toub1-6/+7
Also fixing the class? annotation on public LazyInitializer methods.
2019-04-02Nullable: Overlapped and friends (#23656)Stephen Toub6-39/+44
* Nullable: Overlapped and friends * Address PR feedback
2019-04-01Nullable: WaitHandles (#23604)Stephen Toub2-3/+4
2019-04-01Nullable: Monitor (#23603)Stephen Toub1-2/+1
2019-04-01Nullable: SynchronizationContext (#23634)Stephen Toub2-9/+11
2019-04-01Nullable: ThreadPool (#23600)Stephen Toub1-6/+9
2019-03-03Mirror changes from dotnet/corert (#22985)Dotnet-GitSync-Bot1-2/+2
* Move fully managed TimerQueue implementation to shared partition (#7111) * Update CoreCLR for changes in shared partition
2019-03-02Move more Thread logic to shared partition (#22935)Marek Safar2-32/+4
* Move more Thread logic to shared partition * Keep the fields in runtime part for reliable layout structure
2019-03-01Implement Serialization GuardMorgan Brown1-0/+4
Add Serialization Guard API and consume it in CoreLib targets
2019-03-01Another small tweak to fix Thread behavioral difference (#22943)Stephen Toub1-1/+1
To match existing behavior: https://github.com/dotnet/corefx/blob/5dc8132370532804a5381b90e2ce87d6c52b61f6/src/Common/src/CoreLib/System/Threading/Thread.Unix.cs#L13
2019-02-28Fix GetApartmentState value on Unix to be Unknown (#22928)Stephen Toub1-2/+2
* Fix GetApartmentState value on Unix to be Unknown The code in corefx is returning ApartmentState.Unknown on Unix. This new coreclr implementation should do the same. * Fix visibility on TrySetApartmentStateUnchecked
2019-02-27Address PR feedback (clean up style in Thread.CoreCLR.cs)Stephen Toub2-196/+136
2019-02-27Fix Thread-related breaking changesStephen Toub1-14/+11
- Thread.ExecutionContext needs to return ExecutionContext.Capture() to public callers. - Fix restoring of culture to be inside of the ExecutionContext callback where applicable
2019-02-27Fix Thread.ExecutionContext breaking change (#22882)Stephen Toub1-2/+2
Its getter is a public API and can't be made internal.
2019-02-26Move Thread to shared CoreLib (#22744)Filip Navara1-75/+295
* Move Thread to shared CoreLib * Remove all local variables from Thread in shared code * Remove duplicate checks * Port back CoreRT changes needed for shared code * Fix missing culture initialization in ThreadStart() * Adjust for shared WaitHandle
2019-02-25Move WaitHandle to shared CoreLib (#22634)Filip Navara2-471/+41
* Move part of WaitHandle to shared CoreLib * Bring back OpenExistingResult to fix build * Move reminder of WaitHandle to shared, implement SynchronizationContext logic in managed code, handle SafeHandle referencing in managed code * Update with changes neeeded for CoreRT * Span -> ReadOnlySpan * Remove dead code * Fix SafeHandle error handling * Avoid double check on input values in WaitHandle.WaitOne overloads * Make OpenExistingResult private protected instead of internal * Make WaitHandle._waitHandle private * Code style fixes * Remove unnecessary GC.KeepAlive * Move ERROR_TOO_MANY_POSTS exception handling to CoreCLR specific code * Add cache for wait arrays to match previous CoreRT behavior and reduce GC pressure, change unmanaged code to allocate small array on stack * Address PR feedback * Reduce allocations/copying by moving stack allocation to managed code * Address PR feedback * Minor code reshuffle * Move thread local access close to each other * Address code style feedback * Add const to Wait* constants
2019-02-14Remove unnecessary fields from WaitHandle (#22593)Filip Navara1-43/+11
* Remove unnecessary fields from WaitHandle * Drop volatile from _waitHandle * Address race condition in unmanaged code * Remove unused hasThreadAffinity parameters * Fix FCDECL argument counts
2019-02-13Replace Win32Native.cs with Interop files (#22540)Stephen Toub3-18/+9
* Replace Win32Native.cs with Interop files - Replace Win32Native usage with existing Interop.* calls where they already existed - Moved Win32Native.* to their own files otherwise, and changed call sites - Left a stub Win32Native in place to handle some emitted IL from the runtime. The current infrastructure doesn't support targeting nested types, like Interop.Kernel32, and fixing that would be more involved. * Remove Win32Native.cs Replace emitted calls with ones to Marshal. * Fix incorrectly changed field * Fix Kernel32 -> Ole32
2019-02-11Move Volatile to shared (#22523)Stephen Toub1-404/+0
* Move Volatile to shared This largely takes corert's implementation, which uses Unsafe.As and volatile fields. We could investigate also removing the JIT's replacements subsequently. * Add [Intrinsic] attributes
2019-02-04Move SynchronizationContext to shared partition (#22389)Marek Safar4-227/+94
* Move SynchronizationContext to shared partition * Move WaitHelperNative to WaitHandle
2019-01-27Move Timer to shared CoreLib partition. (#22231)Filip Navara2-957/+106
* Move Timer to shared CoreLib partition. * Move SignalNoCallbacksRunning back to shared code, add static EventWaitHandle.Set. * Remove AppDomain references from shared Timer code, reshuffle some code out of SetTimer in non-shared code. * Change m_ prefix to match code style.
2019-01-24Rename TplEtwProvider to TplEventSource (#22194)Jan Kotas1-5/+5
* Rename TplEtwProvider to TplEventSource * Rename etwLog to log
2019-01-24Move TaskContinuation to shared partition (#22167)Marek Safar1-851/+0
* Move TaskContinuation to shared partition * Remove TASK_STATE_THREAD_WAS_ABORTED from Task * Use already existing ThrowAsync
2019-01-24IOCompletionCallback moved to shared partitionJan Kotas1-6/+0
2019-01-23Enable warnings-as-errors for System.Private.CoreLib (#22164)Stephen Toub2-2/+1
And disable several NoWarns.
2019-01-23Move common ThreadPool code to shared CoreLib partition. (#22115)Filip Navara2-1595/+374
* Move common ThreadPool code to shared CoreLib partition. * Move numWorkingThreads counting out of shared code. * Rename ThreadPoolGlobals.vmTpInitialized to threadPoolInitialized. Remove exception handling from ThreadPoolWorkQueue.Dispatch. Remove obsolete code from ThreadPoolWorkQueue.Dispatch. Rename ThreadPool.EnsureVMInitialized to ThreadPool.EnsureInitialized.
2019-01-23Move Task to shared partition (#22105)Marek Safar3-6702/+5
2019-01-21Move TplEtwProvider to shared partition (#22120)Marek Safar1-594/+0
2019-01-20Move Task factory type to shared partition (#22089)Marek Safar2-5177/+0
2019-01-19Fix CoreCLR build for changes in shared partitionJan Kotas5-164/+82
2019-01-18Move AsyncCausality to shared partition (#22062)Marek Safar1-53/+0
* Move AsyncCausality to shared partition * Set FeatureAsyncCausalityTracer property
2019-01-14Fix TaskCompletionSource to avoid capturing ExecutionContext (#21981)Stephen Toub1-4/+4
When a TaskCompletionSource is constructed without any arguments, it simply creates a Task using a simple Task constructor that sets a few fields and is done. When it's constructed with options, though, those options are validated, and then it calls into a shared routine that configures based on those options. A previous set of changes resulted in erroneously doing the ExecutionContext.Capture for the task inside of that shared routine, rather than only doing it for tasks that actually have a delegate to be executed. The net effect of this is that, while TaskCompletionSources created with the parameterless constructor correctly did not capture ExecutionContext, TaskCompletionSources created with options erroneously did; this doesn't have a functional impact, because that ExecutionContext isn't used for anything, but it can have a performance impact, in particular for memory, if the resulting Task is cached, and if the captured ExecutionContext holds onto some expensive object from an AsyncLocal, such that the cached Task then does so, too. The fix is simply to move the capture from the shared routine that's invoked in two places to instead be done only in the one caller that's for tasks with delegates.
2019-01-05(C#7) Use pattern matching `is` rather than `as` with null check (#21828)Ben Adams2-47/+28
* Use pattern matching `is` rather than `as` with null check
2019-01-05Remove redundant unsafe contexts (#21826)Ben Adams3-4/+4