avoid building up a lot of threads all waiting for their chance to run a push
Only 2 threads are needed, one running, and one waiting to push something new. Any more is redundant and wasteful.
This commit is contained in:
parent
6e04194e84
commit
cc68b340ff
2 changed files with 59 additions and 18 deletions
|
@ -133,6 +133,9 @@ data NetMessager = NetMessager
|
|||
-- only one side of a push can be running at a time
|
||||
-- the TMVars are empty when nothing is running
|
||||
, netMessagerPushRunning :: SideMap (TMVar ClientID)
|
||||
-- number of threads trying to push to the same client
|
||||
-- at the same time (either running, or waiting to run)
|
||||
, netMessagerPushThreadCount :: SideMap (TVar (M.Map ClientID Int))
|
||||
-- incoming messages containing data for a push,
|
||||
-- on a per-client and per-side basis
|
||||
, netMessagesInboxes :: SideMap Inboxes
|
||||
|
@ -146,3 +149,4 @@ newNetMessager = NetMessager
|
|||
<*> newEmptySV
|
||||
<*> mkSideMap newEmptyTMVar
|
||||
<*> mkSideMap (newTVar M.empty)
|
||||
<*> mkSideMap (newTVar M.empty)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue