3 ms·
Writing threaded code is not all that difficult. It's finding the bugs that is. It's because the problems are not easily reproducible. The synchronization mod
by russell 18y ago
Writing threaded code is not all that difficult. It's finding the bugs that is. It's because the problems are not easily reproducible. The synchronization model in Java makes it all too easy to muck it up. Some simple ideas:
Threads are very handy if they don't talk to each other like java servlets.
If you have a shared variable, make it a monitor.
If you have a share resource resource, make it immutable.
If you have 45 shared variables, you are doing it wrong.
Use library objects like queues to communicate between threads.
Use a shared-nothing model like in erlang.