Thread.Join理解

Thread.Join:Blocks the calling thread until a thread terminates

MainThread which played a SubThread, call begins SubThread.Join, MainThread start blocks until SubThread finished

conme form: https://www.cnblogs.com/slikyn/articles/1525940.html

    //
    // 摘要:
    //     SubThread处理期间,阻止MainThread,直到由该实例表示的线程终止或经过了指定时间为止。
    //
    // 参数:
    //   millisecondsTimeout:
    //     等待线程终止的毫秒数。
    //
    // 返回结果:
    //     如果线程已终止,则为 true;如果 false 参数指定的时间量已过之后还未终止线程,则为 millisecondsTimeout。
    //
    // 异常:
    //   T:System.ArgumentOutOfRangeException:
    //     millisecondsTimeout 的值为负数,且不等于 System.Threading.Timeout.Infinite(以毫秒为单位)。
    //
    //   T:System.Threading.ThreadStateException:
    //     该线程尚未启动。
    [SecuritySafeCritical]
    public bool Join(int millisecondsTimeout);

Guess you like

Origin www.cnblogs.com/swobble/p/11911080.html