Skip to content

Commit c9f04e2

Browse files
authored
Merge pull request dotnet#7657 from dotnet-bot/from-tfs
Merge changes from TFS
2 parents 17c64ff + ef146cf commit c9f04e2

File tree

1 file changed

+112
-5
lines changed

1 file changed

+112
-5
lines changed

src/mscorlib/src/System/Threading/Thread.cs

Lines changed: 112 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,60 @@ public static void ResetAbort()
595595
[System.Security.SecurityCritical] // auto-generated
596596
[MethodImplAttribute(MethodImplOptions.InternalCall)]
597597
private extern void ResumeInternal();
598-
#endif // !FEATURE_CORECLR
598+
599+
/*=========================================================================
600+
** Interrupts a thread that is inside a Wait(), Sleep() or Join(). If that
601+
** thread is not currently blocked in that manner, it will be interrupted
602+
** when it next begins to block.
603+
=========================================================================*/
604+
[System.Security.SecuritySafeCritical] // auto-generated
605+
[SecurityPermission(SecurityAction.Demand, ControlThread = true)]
606+
public new void Interrupt() => base.Interrupt();
607+
608+
/*=========================================================================
609+
** Returns the priority of the thread.
610+
**
611+
** Exceptions: ThreadStateException if the thread is dead.
612+
=========================================================================*/
613+
614+
public new ThreadPriority Priority
615+
{
616+
[System.Security.SecuritySafeCritical] // auto-generated
617+
get
618+
{
619+
return base.Priority;
620+
}
621+
[System.Security.SecuritySafeCritical] // auto-generated
622+
[HostProtection(SelfAffectingThreading = true)]
623+
set
624+
{
625+
base.Priority = value;
626+
}
627+
}
628+
629+
/*=========================================================================
630+
** Returns true if the thread has been started and is not dead.
631+
=========================================================================*/
632+
public new bool IsAlive
633+
{
634+
[System.Security.SecuritySafeCritical] // auto-generated
635+
get
636+
{
637+
return base.IsAlive;
638+
}
639+
}
640+
641+
/*=========================================================================
642+
** Returns true if the thread is a threadpool thread.
643+
=========================================================================*/
644+
public new bool IsThreadPoolThread
645+
{
646+
[System.Security.SecuritySafeCritical] // auto-generated
647+
get
648+
{
649+
return base.IsThreadPoolThread;
650+
}
651+
}
599652

600653
/*=========================================================================
601654
** Waits for the thread to die or for timeout milliseconds to elapse.
@@ -606,6 +659,15 @@ public static void ResetAbort()
606659
** ThreadInterruptedException if the thread is interrupted while waiting.
607660
** ThreadStateException if the thread has not been started yet.
608661
=========================================================================*/
662+
[System.Security.SecuritySafeCritical]
663+
[HostProtection(Synchronization = true, ExternalThreading = true)]
664+
public new void Join() => base.Join();
665+
666+
[System.Security.SecuritySafeCritical]
667+
[HostProtection(Synchronization = true, ExternalThreading = true)]
668+
public new bool Join(int millisecondsTimeout) => base.Join(millisecondsTimeout);
669+
#endif // !FEATURE_CORECLR
670+
609671
[HostProtection(Synchronization=true, ExternalThreading=true)]
610672
public bool Join(TimeSpan timeout)
611673
{
@@ -761,6 +823,42 @@ private void SetStartHelper(Delegate start, int maxStackSize)
761823
public extern void DisableComObjectEagerCleanup();
762824
#endif //FEATURE_COMINTEROP
763825

826+
#if !FEATURE_CORECLR
827+
/*=========================================================================
828+
** Return whether or not this thread is a background thread. Background
829+
** threads do not affect when the Execution Engine shuts down.
830+
**
831+
** Exceptions: ThreadStateException if the thread is dead.
832+
=========================================================================*/
833+
public new bool IsBackground
834+
{
835+
[System.Security.SecuritySafeCritical] // auto-generated
836+
get
837+
{
838+
return base.IsBackground;
839+
}
840+
[System.Security.SecuritySafeCritical] // auto-generated
841+
[HostProtection(SelfAffectingThreading = true)]
842+
set
843+
{
844+
base.IsBackground = value;
845+
}
846+
}
847+
848+
/*=========================================================================
849+
** Return the thread state as a consistent set of bits. This is more
850+
** general then IsAlive or IsBackground.
851+
=========================================================================*/
852+
public new ThreadState ThreadState
853+
{
854+
[System.Security.SecuritySafeCritical] // auto-generated
855+
get
856+
{
857+
return base.ThreadState;
858+
}
859+
}
860+
#endif // !FEATURE_CORECLR
861+
764862
#if FEATURE_COMINTEROP_APARTMENT_SUPPORT
765863
/*=========================================================================
766864
** An unstarted thread can be marked to indicate that it will host a
@@ -786,6 +884,15 @@ public ApartmentState ApartmentState
786884
}
787885
}
788886

887+
#if !FEATURE_CORECLR
888+
[System.Security.SecuritySafeCritical] // auto-generated
889+
public new ApartmentState GetApartmentState() => base.GetApartmentState();
890+
891+
[System.Security.SecuritySafeCritical] // auto-generated
892+
[HostProtection(Synchronization=true, SelfAffectingThreading=true)]
893+
public new bool TrySetApartmentState(ApartmentState state) => base.TrySetApartmentState(state);
894+
#endif // !FEATURE_CORECLR
895+
789896
[System.Security.SecuritySafeCritical] // auto-generated
790897
[HostProtection(Synchronization=true, SelfAffectingThreading=true)]
791898
public void SetApartmentState(ApartmentState state)
@@ -1115,7 +1222,7 @@ private CultureInfo GetCurrentCultureNoAppX() {
11151222
#endif
11161223
}
11171224

1118-
#if! FEATURE_LEAK_CULTURE_INFO
1225+
#if !FEATURE_LEAK_CULTURE_INFO
11191226
[System.Security.SecurityCritical] // auto-generated
11201227
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
11211228
[SuppressUnmanagedCodeSecurity]
@@ -1147,7 +1254,7 @@ internal Context GetCurrentContextInternal()
11471254
}
11481255
return m_Context;
11491256
}
1150-
#endif
1257+
#endif
11511258

11521259

11531260
#if FEATURE_IMPERSONATION
@@ -1187,7 +1294,7 @@ private void SetPrincipalInternal(IPrincipal principal)
11871294
}
11881295
#endif // FEATURE_IMPERSONATION
11891296

1190-
#if FEATURE_REMOTING
1297+
#if FEATURE_REMOTING
11911298

11921299
// This returns the exposed context for a given context ID.
11931300
[System.Security.SecurityCritical] // auto-generated
@@ -1233,7 +1340,7 @@ public static AppDomain GetDomain()
12331340
if (ad == null)
12341341
ad = GetDomainInternal();
12351342

1236-
#if FEATURE_REMOTING
1343+
#if FEATURE_REMOTING
12371344
Contract.Assert(CurrentThread.m_Context == null || CurrentThread.m_Context.AppDomain == ad, "AppDomains on the managed & unmanaged threads should match");
12381345
#endif
12391346
return ad;

0 commit comments

Comments
 (0)