using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace ThreanSuspend
{
class Class1
{
public delegate void ThreadStartRoutine(UIntPtr ThreadParameter);
[DllImport("Kernel32")]
public static extern IntPtr CreateThread(IntPtr SecurityAttributes, UInt32 StackSize,
ThreadStartRoutine StartFunction, UIntPtr ThreadParameter,
UInt32 CreationFlags, out UInt32 ThreadId);
public void NativeThread()
{
UInt32 threadId;
IntPtr hThread = CreateThread(IntPtr.Zero, 0,
new ThreadStartRoutine(UnmgdThreadFunc), UIntPtr.Zero, 0, out threadId);
}
private static void UnmgdThreadFunc(UIntPtr p)
{
Console.WriteLine("In UnmgdThreadFunc");
Int32 x = 0;
x = 10 / x;
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace ThreanSuspend
{
class Class1
{
public delegate void ThreadStartRoutine(UIntPtr ThreadParameter);
[DllImport("Kernel32")]
public static extern IntPtr CreateThread(IntPtr SecurityAttributes, UInt32 StackSize,
ThreadStartRoutine StartFunction, UIntPtr ThreadParameter,
UInt32 CreationFlags, out UInt32 ThreadId);
public void NativeThread()
{
UInt32 threadId;
IntPtr hThread = CreateThread(IntPtr.Zero, 0,
new ThreadStartRoutine(UnmgdThreadFunc), UIntPtr.Zero, 0, out threadId);
}
private static void UnmgdThreadFunc(UIntPtr p)
{
Console.WriteLine("In UnmgdThreadFunc");
Int32 x = 0;
x = 10 / x;
}
}
}