Test code where gate is closed unsuccessfully
()
| 229 | print exitlog |
| 230 | |
| 231 | def test2(): |
| 232 | """ Test code where gate is closed unsuccessfully """ |
| 233 | |
| 234 | print 'test1()...' |
| 235 | |
| 236 | gate = ThreadGate(10, 5) |
| 237 | |
| 238 | random.seed() |
| 239 | |
| 240 | print 'Starting threads...' |
| 241 | # Create 10 threads |
| 242 | threads = [] |
| 243 | threads.append(OwnerThread(gate)) |
| 244 | |
| 245 | for x in range(10): |
| 246 | threads.append(SampleThread(x, gate)) |
| 247 | |
| 248 | # Start threads and join |
| 249 | for x in range(11): |
| 250 | threads[x].start() |
| 251 | |
| 252 | |
| 253 | # Join with threads |
| 254 | for x in range(11): |
| 255 | threads[x].join() |
| 256 | |
| 257 | print 'Joined with threads' |
| 258 | |
| 259 | print 'Gate count=>',gate.get_count() |
| 260 | |
| 261 | # Exit and entry logs must be same |
| 262 | print enterlog |
| 263 | print exitlog |
| 264 | |
| 265 | test1() |
| 266 |
no test coverage detected