Java
java中的ncurrent包中提供了一個類LockSupport
在java中
以下是引用片段
public static void park(Object blocker) {
Thread t = Thread
setBlocker(t
unsafe
setBlocker(t
}
當一個線程調用LockSupport
以下是引用片段
public class LockSupport
{
private static LocalDataStoreSlot slot = Thread
(
public static void Park(Object blocker)
{
Thread thread = Thread
Thread
lock (thread)
{
Monitor
}
}
public static void Unpark(Thread thread)
{
if (thread == null) return;
lock (thread)
{
Monitor
}
}
}
其中的slot是可以不需要的
From:http://tw.wingwit.com/Article/program/net/201311/12409.html