java.lang.Thread.unpark()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(201)

本文整理了Java中java.lang.Thread.unpark()方法的一些代码示例,展示了Thread.unpark()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Thread.unpark()方法的具体详情如下:
包路径:java.lang.Thread
类名称:Thread
方法名:unpark

Thread.unpark介绍

[英]Unparks this thread. This unblocks the thread it if it was previously parked, or indicates that the thread is "preemptively unparked" if it wasn't already parked. The latter means that the next time the thread is told to park, it will merely clear its latent park bit and carry on without blocking.

See java.util.concurrent.locks.LockSupport for more in-depth information of the behavior of this method.
[中]解开这条线。如果该线程以前已停驻,则会解除对其的阻止;如果该线程尚未停驻,则表示该线程已“先发制人地取消被拦截”。后者意味着下一次线程被告知驻车时,它只会清除其潜在的驻车位并继续进行而不会阻塞。
参见java。util。同时发生的锁。LockSupport可获取此方法行为的更深入信息。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Unparks the given object, which must be a {@link Thread}.
 *
 * <p>See {@link java.util.concurrent.locks.LockSupport} for more
 * in-depth information of the behavior of this method.</p>
 *
 * @param obj non-null; the object to unpark
 */
public void unpark(Object obj) {
  if (obj instanceof Thread) {
    ((Thread) obj).unpark();
  } else {
    throw new IllegalArgumentException("valid for Threads only");
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * Unparks the given object, which must be a {@link Thread}.
 *
 * <p>See {@link java.util.concurrent.locks.LockSupport} for more
 * in-depth information of the behavior of this method.</p>
 *
 * @param obj non-null; the object to unpark
 */
public void unpark(Object obj) {
  if (obj instanceof Thread) {
    ((Thread) obj).unpark();
  } else {
    throw new IllegalArgumentException("valid for Threads only");
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Unparks the given object, which must be a {@link Thread}.
 *
 * <p>See {@link java.util.concurrent.locks.LockSupport} for more
 * in-depth information of the behavior of this method.</p>
 *
 * @param obj non-null; the object to unpark
 */
public void unpark(Object obj) {
  if (obj instanceof Thread) {
    ((Thread) obj).unpark();
  } else {
    throw new IllegalArgumentException("valid for Threads only");
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Unparks the given object, which must be a {@link Thread}.
 *
 * <p>See {@link java.util.concurrent.locks.LockSupport} for more
 * in-depth information of the behavior of this method.</p>
 *
 * @param obj non-null; the object to unpark
 */
public void unpark(Object obj) {
  if (obj instanceof Thread) {
    ((Thread) obj).unpark();
  } else {
    throw new IllegalArgumentException("valid for Threads only");
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Unparks the given object, which must be a {@link Thread}.
 *
 * <p>See {@link java.util.concurrent.locks.LockSupport} for more
 * in-depth information of the behavior of this method.</p>
 *
 * @param obj non-null; the object to unpark
 */
public void unpark(Object obj) {
  if (obj instanceof Thread) {
    ((Thread) obj).unpark();
  } else {
    throw new IllegalArgumentException("valid for Threads only");
  }
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Unparks the given object, which must be a {@link Thread}.
 *
 * <p>See {@link java.util.concurrent.locks.LockSupport} for more
 * in-depth information of the behavior of this method.</p>
 *
 * @param obj non-null; the object to unpark
 */
public void unpark(Object obj) {
  if (obj instanceof Thread) {
    ((Thread) obj).unpark();
  } else {
    throw new IllegalArgumentException("valid for Threads only");
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Unparks the given object, which must be a {@link Thread}.
 *
 * <p>See {@link java.util.concurrent.locks.LockSupport} for more
 * in-depth information of the behavior of this method.</p>
 *
 * @param obj non-null; the object to unpark
 */
public void unpark(Object obj) {
  if (obj instanceof Thread) {
    ((Thread) obj).unpark();
  } else {
    throw new IllegalArgumentException("valid for Threads only");
  }
}

相关文章