473,396 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Queue Collection changed

I have a queue, wich recieves a lot of messages (between 10 and 100 a
second)
There is thread that takes care on this queue, but as far as I see it can
not follow the messages so "Collection was modified; enumeration operation
may not execute." exception thows. How to take care on it

txn

BTW. this not any other problem then reading from queue. I double checked
it.
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
Nov 16 '05 #1
2 1929
Tamir.

Not sure what type of queue you're using or how you're handling it.

However, the error you're getting is from using an enumerator and modifying
the
underlying collection. If you must modify it (or it is being modified for
you), switch
from a "foreach" loop to a "for" or "while" loop.

--
-Philip Rieck
http://philiprieck.com/blog/

-
"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I have a queue, wich recieves a lot of messages (between 10 and 100 a
second)
There is thread that takes care on this queue, but as far as I see it can
not follow the messages so "Collection was modified; enumeration operation
may not execute." exception thows. How to take care on it

txn

BTW. this not any other problem then reading from queue. I double checked
it.
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "

Nov 16 '05 #2
It's possible one thread could be in the middle of a foreach block
when another thread does an Insert or Delete. Are you using lock or
another form of thread synchronization?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 31 Oct 2004 12:48:23 +0200, "Tamir Khason"
<ta**********@tcon-NOSPAM.co.il> wrote:
I have a queue, wich recieves a lot of messages (between 10 and 100 a
second)
There is thread that takes care on this queue, but as far as I see it can
not follow the messages so "Collection was modified; enumeration operation
may not execute." exception thows. How to take care on it

txn

BTW. this not any other problem then reading from queue. I double checked
it.


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: chrisben | last post by:
Hi I often use Queue.Synchronized method to create a queue for multithread writing. I also know I could use SyncRoot and lock to write Queue. Could anyone here please explain to me the pros and...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
9
by: Brian Henry | last post by:
If i inherite a queue class into my class, and do an override of the enqueue member, how would i then go about actually doing an enqueue of an item? I am a little confused on this one... does over...
4
by: nhmark64 | last post by:
Hi, Does System.Collections.Generic.Queue not have a Synchronized method because it is already in effect synchronized, or is the Synchronized functionality missing from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.