PR_JoinThread 编辑

Blocks the calling thread until a specified thread terminates.

Syntax

#include <prthread.h>

/wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRStatus PR_JoinThread(/wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRThread *thread);

Parameter

PR_JoinThread has the following parameter:

thread
A valid identifier for the thread that is to be joined.

Returns

The function returns one of the following values:

  • If successful, PR_SUCCESS
  • If unsuccessful--for example, if no joinable thread can be found that corresponds to the specified target thread, or if the target thread is unjoinable--PR_FAILURE.

Description

PR_JoinThread is used to synchronize the termination of a thread. The function is synchronous in that it blocks the calling thread until the target thread is in a joinable state. PR_JoinThread returns to the caller only after the target thread returns from its root function.

PR_JoinThread must not be called until after PR_CreateThread has returned.  If PR_JoinThread is not called on the same thread as PR_CreateThread, then it is the caller's responsibility to ensure that PR_CreateThread has completed.

Several threads cannot wait for the same thread to complete. One of the calling threads operates successfully, and the others terminate with the error PR_FAILURE.

The calling thread is not blocked if the target thread has already terminated.

PR_JoinThread is interruptable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:39 次

字数:2179

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文