1. In a computer system, a method of controlling concurrency of a set of threads executing in a plurality of state machines, the method comprising the steps of: forming connections for exchanging messages between pairs of the state machines; using the threads to deliver messages arriving on the connections to state machines and process the messages in the state machines; for a set of the state machines having a common relationship, grouping connections from the set to state machines outside the set into a clique; providing a guard value associated with the clique for tracking whether any thread is currently executing in the set; while a first thread is delivering a first incoming message arriving on a first connection in the clique to a first state machine in the set, setting the guard value to indicate a thread is executing in the set and preventing any other thread from delivering another message arriving on any connection in the clique to any state machine in the set, whereby only a single thread executes in the set at a time.