Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[System.Private.CoreLib] Initial build pass #12450

Merged
merged 10 commits into from Jan 17, 2019
4 changes: 4 additions & 0 deletions mcs/class/System.Private.CoreLib/AssemblyInfo.cs
@@ -1,3 +1,7 @@
//
// System.Private.CoreLib Assembly
//

using System;

[assembly: CLSCompliant (true)]
@@ -0,0 +1,112 @@
using System;
using System.Threading;
using System.Runtime.ConstrainedExecution;
using System.Runtime.CompilerServices;

namespace Internal.Runtime.Augments
{
public partial class RuntimeThread : CriticalFinalizerObject
{
// Note: Magic number copied from CoreRT's RuntimeThread.cs. See the original source code for an explanation.
internal static readonly int OptimalMaxSpinWaitsPerSpinIteration = 64;

readonly Thread thread;

RuntimeThread (Thread t)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these files use the mono coding conventions ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure, I suspect some changes will eventually migrate to shared which means coreclr coding convention, do we want to do the conversion at that point?

thread = t;
}

public bool IsBackground {
get { throw new NotImplementedException (); }
set { }
}

public static RuntimeThread CurrentThread => throw new NotImplementedException ();

internal static ulong CurrentOSThreadId {
get {
throw new NotImplementedException ();
}
}

public extern bool IsThreadPoolThread
{
[MethodImpl (MethodImplOptions.InternalCall)]
get;
}

public int ManagedThreadId => AsThread ().ManagedThreadId;

public string Name {
get {
return AsThread ().Name;
}
set {
AsThread ().Name = value;
}
}

public ThreadPriority Priority {
get {
throw new NotImplementedException ();
}
set {
}
}

public ThreadState ThreadState {
get {
throw new NotImplementedException ();
}
}

public extern bool IsAlive {
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}

public static bool Yield () => Thread.Yield ();

public void Interrupt ()
{
throw new NotImplementedException ();
}

private Thread AsThread ()
{
throw new NotImplementedException ();
}

public static RuntimeThread Create (ThreadStart start) => throw new NotImplementedException ();
public static RuntimeThread Create (ThreadStart start, int maxStackSize) => throw new NotImplementedException ();
public static RuntimeThread Create (ParameterizedThreadStart start) => throw new NotImplementedException ();
public static RuntimeThread Create (ParameterizedThreadStart start, int maxStackSize) => throw new NotImplementedException ();

public static int GetCurrentProcessorId ()
{
// TODO: Implement correctly
return 1;
}

public static bool SpinWait (int iterations)
{
Thread.SpinWait (iterations);
return true;
}

public static void Sleep (int millisecondsTimeout) => Thread.Sleep (millisecondsTimeout);

public void Start () => throw new NotImplementedException ();
public void Start (object parameter) => throw new NotImplementedException ();

public void Join () => JoinInternal (Timeout.Infinite);

public bool Join (int millisecondsTimeout) => JoinInternal (millisecondsTimeout);

private bool JoinInternal (int millisecondsTimeout)
{
throw new NotImplementedException ();
}
}
}
10 changes: 2 additions & 8 deletions mcs/class/System.Private.CoreLib/Makefile
Expand Up @@ -2,11 +2,5 @@ thisdir = class/System.Private.CoreLib
SUBDIRS =
include ../../build/rules.make

LIBRARY = System.Private.CoreLib.dll
LIB_REFS =
EXTRA_DIST_FILES =

LIB_MCS_FLAGS =
DEFAULT_REFERENCES =

include ../../build/library.make
all-local:
dotnet build -p:TargetsUnix=true -p:TargetsOSX=true System.Private.CoreLib.csproj
@@ -0,0 +1,13 @@
using System.Threading;

namespace Microsoft.Win32.SafeHandles
{
partial class SafeWaitHandle
{
protected override bool ReleaseHandle ()
{
NativeEventCalls.CloseEvent_internal (handle);
return true;
}
}
}
@@ -0,0 +1,60 @@
using System;
using System.Runtime.InteropServices;

namespace Microsoft.Win32
{
static class UnsafeNativeMethods
{
internal static unsafe class ManifestEtw
{
internal unsafe delegate void EtwEnableCallback(
[In] ref Guid sourceId,
[In] int isEnabled,
[In] byte level,
[In] long matchAnyKeywords,
[In] long matchAllKeywords,
[In] EVENT_FILTER_DESCRIPTOR* filterData,
[In] void* callbackContext
);

[StructLayout(LayoutKind.Sequential)]
unsafe internal struct EVENT_FILTER_DESCRIPTOR
{
public long Ptr;
public int Size;
public int Type;
}

internal enum ActivityControl : uint
{
EVENT_ACTIVITY_CTRL_GET_ID = 1,
EVENT_ACTIVITY_CTRL_SET_ID = 2,
EVENT_ACTIVITY_CTRL_CREATE_ID = 3,
EVENT_ACTIVITY_CTRL_GET_SET_ID = 4,
EVENT_ACTIVITY_CTRL_CREATE_SET_ID = 5
}

internal const int ERROR_ARITHMETIC_OVERFLOW = 534;
internal const int ERROR_NOT_ENOUGH_MEMORY = 8;
internal const int ERROR_MORE_DATA = 0xEA;

internal const int EVENT_CONTROL_CODE_DISABLE_PROVIDER = 0;
internal const int EVENT_CONTROL_CODE_ENABLE_PROVIDER = 1;
internal const int EVENT_CONTROL_CODE_CAPTURE_STATE = 2;
}
}

// TODO: Should already exist somewhere else
static class Win32Native
{
internal static int GetCurrentThreadId ()
{
throw new NotImplementedException ();
}

internal static uint GetCurrentProcessId ()
{
throw new NotImplementedException ();
}
}
}