< NSPR API Reference < Threads
Sets the interrupt request for a target thread.
PR_Interrupt has the following parameter:
thread
The function returns one of the following values:
PR_SUCCESS.
PR_FAILURE.
The purpose of PR_Interrupt is to request that a thread performing some task stop what it is doing and return to some control point. It is assumed that a control point has been mutually arranged between the thread doing the interrupting and the thread being interrupted. When the interrupted thread reaches the prearranged point, it can communicate with its peer to discover the real reason behind the change in plans.
The interrupt request remains in the thread's state until it is delivered exactly once or explicitly canceled. The interrupted thread returns PR_FAILURE (-1) with an error code (see PR_GetError) for blocking operations that return a PRStatus (such as I/O operations, monitor waits, or waiting on a condition). To check whether the thread was interrupted, compare the result of PR_GetError with PR_PENDING_INTERRUPT_ERROR.
PR_Interrupt may itself fail if the target thread is invalid.
PR_Interrupt has the following limitations and known bugs:
PR_Read call on PR_STDIN cannot be interrupted even though it may block indefinitely.
PR_Connect cannot be interrupted.
Page last modified 21:34, 12 Feb 2006 by Callek