| January 14, 2009 2:36 PM PST | |
This sample contains a full project that shows how to create multiple threads and use Mutexes. The program creates multiple threads to calculate the prime numbers for any given range. The purpose of this program is not to efficiently calculate primes, but to show how to use mutexes; wait for a thread to complete, and how to release mutexes. The program creates 2 threads and calculates the prime numbers. The main function takes the upper bound as an argument to compute primes within the upper bound range and displays all the prime numbers found.
Web developers, developers building application server code, and developers working with multiple processor systems. Any developers working in a 32-bit Windows environment where optimization of code would be of interest via multi-threaded programming would find this example program worth a look.
Full Project
Nonspecific
Hardware Systems: Systems running Intel® Xeon® processors
Operating Systems: Microsoft Windows* 2000 and other Win32 operating systems
Compilers: nonspecific
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (2) 
| August 11, 2009 5:32 PM PDT
Jose Jesus Ambriz Meza
| This is a simple but very good examples. how can I upload a code? |



sandip
I, run this program and when i give upper bound of numbers more than 500 the program crashes.
that is on an average with 10 tries, 3-4 sucess are there.
what could be the cause please help
thnx in advance