Heres a question, when writing a few programs I have been presented with the choice to use or not use threads. Every time I usually choose not to and just multi-plex with some async calls. Under what circumstances is it better or worse to use threads and why? What do you guys think?
On multiprocessor systems, if you run 1 thread per CPU, you utilize all CPUs.
Quote from: SecretShop on March 29, 2006, 01:37 PM
Heres a question, when writing a few programs I have been presented with the choice to use or not use threads. Every time I usually choose not to and just multi-plex with some async calls. Under what circumstances is it better or worse to use threads and why? What do you guys think?
When you need to do a background task and not interrupt the GUI. (This is common for print spooling or listening for data over the network).
Use non-blocking calls whenever possible (i.e. I/O) and IPC or threads when you need.
OT: does anyone know a Scheme implementation with nonblocking I/O?
Quote from: Banana fanna fo fanna on April 06, 2006, 02:24 PM
OT: does anyone know a Scheme implementation with nonblocking I/O?
Depending on what you're intersted in, have you tried CHICKEN? If you don't already know about it, it can easily interface with C.