Overview
| Artifact ID: | aa1cbe12764e48c09a28360a786dff1444ad271f |
|---|---|
| Ticket: | 2835615fffffffffffffffffffffffffffffffff
Pool suspend/resume feature |
| User & Date: | dkf on 2009-08-17 16:02:26 |
Changes
- icomment:
You could try holding a mutex in the main thread, sending a job to each of the workers which briefly grabs the mutex (i.e. which blocks until the main thread is ready). Since you know that none of the jobs will complete, you can be sure that you've got the pool fully populated and that it won't consume more until you're ready. Then load up the pool's queue with the real jobs and release the mutex from the main thread to fire. But consider whether this is really the right approach. With only two cores, your optimal pool size is pretty small and if you need the main thread to remain responsive then perhaps your pool should only be size 1! Investing in a bigger machine may be more cost effective. (None of the advice in this paragraph is Tcl-specific; it applies to any serious system of thread pools without nasty locking problems, as it is a matter of system resourcing.)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"