Particular/NServiceBus — pull request #1667 by johnsimons (2013-10-14 03:18:32+00:00)
Title: Throughtput limiter changes

There are a few bugs in the `ThroughputLimiter`:

- #1660
- Deadlock between the `MessageProcessed` and `Stop`, the semaphore wait could get stuck forever.
When a semaphore is Disposed the Waits are not released!
- The `Start` and `Stop` of `ThroughputLimiter` need to be called from thread safe code;

### Review Throughput implementation
Currently the throughput implementation is done at the end of the dequeue of a message.

#### What do you mean?
Here is the current pipeline:

1. Message is dequeued
1. Message id processed
1. Throughtput limiter blocks thread

#### Issues with current implementation
Because the Throughtput limiter blocks the thread at the end of the processing, there is no throughput limit enforced when the bus starts!