Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
That exception mostly occurs not because of multithreading but because you are editing the ArrayList inside a for each loop. Any chance that's what you are doing?
-
@bdhobare I know.
But in my case it really was a multithreading problem.
The list was altered by a thread listening for incoming network-traffic, which occours *when it wants* while the list is constantly iterated over.
Because i don't want a buffer-list it threw CME sometimes.:b
Synchronized and all that shit didn't work as expected..
Got shit done by now, the CopyOnWriteList is pretty nice for now. -
matanl26448y@PenguinRage oh really, a data race since elements can not be inserted atomically to a vector in c++ makes sense when I tell you it happened, but it's definitely not intuitive. When something's not intuitive the problem is with the language and not with you (although you can overcome language problems with experience, like people overcomed IE6 by learning all the css hacks)
-
matanl26448y@PenguinRage yes but what I just did is to question the paradigm, there are other ways to deal with concurrency except for explicit mutexes, which may and should be used in most common use cases, maybe all of them except for writing an OS
Multithreading sucks.
undefined
you damn arraylists
fuck you clientthread
gtfo concurrentmodificationexception