Does the chunk of the System.Collections.Concurrent.Partitioner need to be thread safe?
Posted
by Scott Chamberlain
on Stack Overflow
See other posts from Stack Overflow
or by Scott Chamberlain
Published on 2010-06-01T02:37:27Z
Indexed on
2010/06/01
2:43 UTC
Read the original article
Hit count: 339
I am working with the Parallel libraries in .net 4 and I am creating a Partitioner
and the example shown in the MSDN only has a chunk size of 1 (every time a new result is retrieved it hits the data source instead of the local cache. The version I am writing will pull 10000 SQL rows at a time then feed the rows from the cache until it is empty then pull another batch.
Each partition in the Partitioner
has its own chunk. I know every time I call to the IEnumerator
in from the SQL data-source that needs to be thread safe but for use in a Parallel.ForEach
do I need to make every call to the cache for the chunking thread safe?
© Stack Overflow or respective owner