Skip to content

Commit

Permalink
412940 minor threadsafe fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gregw committed Jul 15, 2013
1 parent 5d3760b commit cbc0a11
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,13 @@ protected void doStart() throws Exception

protected void interruptAcceptors()
{
for (Thread thread : _acceptors)
synchronized (this)
{
if (thread != null)
thread.interrupt();
for (Thread thread : _acceptors)
{
if (thread != null)
thread.interrupt();
}
}
}

Expand Down Expand Up @@ -306,9 +309,12 @@ public void join() throws InterruptedException

public void join(long timeout) throws InterruptedException
{
for (Thread thread : _acceptors)
if (thread != null)
thread.join(timeout);
synchronized (this)
{
for (Thread thread : _acceptors)
if (thread != null)
thread.join(timeout);
}
}

protected abstract void accept(int acceptorID) throws IOException, InterruptedException;
Expand Down

0 comments on commit cbc0a11

Please sign in to comment.