Passing Data to Threads
One of the things that I seem to be doing on a somewhat frequent basis is the re-inventing the wheel. Case in point: I had a section of code in a project that was single-threaded, could easily have been multi-threaded and all I really had to do was to handle getting data into the threads and the processed data out.
I thought about it and built something that should have worked, but had totally forgotten that I'd built a thread-safe FIFO queue that would be a wonderful tool in this situation. In the original version, I tried to handle the passing of each bit of data from the controller thread to each worker thread and that turned out to be a major hassle. When I changed focus to the FIFO queue, it was exceptionally easy and fast.
Next time, I'm really going to try to look at the components that work well and build around them. It was amazing the difference.