equal
deleted
inserted
replaced
40 manipState state op = |
40 manipState state op = |
41 atomically $ do |
41 atomically $ do |
42 ls <- readTVar state |
42 ls <- readTVar state |
43 writeTVar state $ op ls |
43 writeTVar state $ op ls |
44 |
44 |
45 manipState2 :: TVar[ClientInfo] -> TVar[RoomInfo] -> ([ClientInfo] -> [RoomInfo] -> ([ClientInfo], [RoomInfo])) -> IO() |
45 manipState2 :: TVar[ClientInfo] -> TVar[RoomInfo] -> ([ClientInfo] -> [RoomInfo] -> ([ClientInfo], [RoomInfo], Bool)) -> IO Bool |
46 manipState2 state1 state2 op = |
46 manipState2 state1 state2 op = |
47 atomically $ do |
47 atomically $ do |
48 ls1 <- readTVar state1 |
48 ls1 <- readTVar state1 |
49 ls2 <- readTVar state2 |
49 ls2 <- readTVar state2 |
50 let (ol1, ol2) = op ls1 ls2 |
50 let (ol1, ol2, res) = op ls1 ls2 |
51 writeTVar state1 ol1 |
51 writeTVar state1 ol1 |
52 writeTVar state2 ol2 |
52 writeTVar state2 ol2 |
|
53 return res |
53 |
54 |