锁定问题 [英] lock problem
本文介绍了锁定问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。
我有一个ArrayList和
有时枚举时,我得到一个
异常,因为另一个线程已添加到ArrayList。
为了解决这个问题,我锁定了枚举,
将ArrayList实例传递给了锁。
但是我仍然得到了同样的例外。
感谢您的帮助。
Sharon。
Hi all.
I have an ArrayList and
sometimes while enumerating through, i get an
exception because another thread has added to the ArrayList.
To solve this problem, i lock the enumeration,
passing the ArrayList instance to the lock.
But i still get the same exception.
Thanks for your help.
Sharon.
推荐答案
您是否锁定了ArrayList或ArrayList.Syncronized属性?
问候,
-
Angel J .HernándezM。
MCSD
" Sharon" < SH **** @ void.null> escribióenel mensaje
新闻:%2 ***************** @ TK2MSFTNGP09.phx.gbl ...
Are you locking the ArrayList or ArrayList.Syncronized property?
Regards,
--
Angel J. Hernández M.
MCSD
"Sharon" <sh****@void.null> escribió en el mensaje
news:%2*****************@TK2MSFTNGP09.phx.gbl...
大家好。
我有一个ArrayList和
有时在枚举时,我得到一个
异常,因为另一个线程已经添加到ArrayList。
为了解决这个问题,我锁定了枚举,
将ArrayList实例传递给锁。
但我仍然得到同样的例外。
感谢您的帮助。
Sharon。
Hi all.
I have an ArrayList and
sometimes while enumerating through, i get an
exception because another thread has added to the ArrayList.
To solve this problem, i lock the enumeration,
passing the ArrayList instance to the lock.
But i still get the same exception.
Thanks for your help.
Sharon.
ArrayList。
" AngelJ.Hernández" <一个********** @ hotmail.com>在留言中写道
news:Ob ************** @ TK2MSFTNGP12.phx.gbl ...
The ArrayList.
"Angel J. Hernández" <an**********@hotmail.com> wrote in message
news:Ob**************@TK2MSFTNGP12.phx.gbl...
您是否锁定了ArrayList或ArrayList.Syncronized属性?
问候,
-
AngelJ.HernándezM。
MCSD
沙龙 < SH **** @ void.null> escribióenel mensaje
新闻:%2 ***************** @ TK2MSFTNGP09.phx.gbl ...
Are you locking the ArrayList or ArrayList.Syncronized property?
Regards,
--
Angel J. Hernández M.
MCSD
"Sharon" <sh****@void.null> escribió en el mensaje
news:%2*****************@TK2MSFTNGP09.phx.gbl...
大家好。<我有一个ArrayList和
有时在枚举时,我得到一个
异常,因为另一个线程已添加到ArrayList。
为了解决这个问题,我锁定了枚举,
将ArrayList实例传递给锁。
但我仍然得到同样的例外。
感谢您的帮助。
Sharon。
Hi all.
I have an ArrayList and
sometimes while enumerating through, i get an
exception because another thread has added to the ArrayList.
To solve this problem, i lock the enumeration,
passing the ArrayList instance to the lock.
But i still get the same exception.
Thanks for your help.
Sharon.
尝试锁定Syncronized ;-)
news:eR ************** @ TK2MSFTNGP10.phx.gbl ...
Try locking the Syncronized ;-)
"Sharon" <sh****@void.null> escribió en el mensaje
news:eR**************@TK2MSFTNGP10.phx.gbl...
ArrayList。
AngelJ.Hernández <一个********** @ hotmail.com>在消息中写道
新闻:Ob ************** @ TK2MSFTNGP12.phx.gbl ...
The ArrayList.
"Angel J. Hernández" <an**********@hotmail.com> wrote in message
news:Ob**************@TK2MSFTNGP12.phx.gbl...
您是否锁定了ArrayList或者ArrayList.Syncronized属性?
问候,
-
AngelJ.HernándezM。
MCSD
;沙龙" < SH **** @ void.null> escribiónelel mensaje
新闻:%2 ***************** @ TK2MSFTNGP09.phx.gbl ...
Are you locking the ArrayList or ArrayList.Syncronized property?
Regards,
--
Angel J. Hernández M.
MCSD
"Sharon" <sh****@void.null> escribió en el mensaje
news:%2*****************@TK2MSFTNGP09.phx.gbl...
>大家好。
>我有一个ArrayList和
>有时在列举时,我会得到一个
>异常,因为另一个线程已添加到ArrayList。
>为了解决这个问题,我锁定了枚举,
>将ArrayList实例传递给锁。
>但我仍然得到同样的例外。
>谢谢你的帮助。
> Sharon。
>
>
> Hi all.
> I have an ArrayList and
> sometimes while enumerating through, i get an
> exception because another thread has added to the ArrayList.
> To solve this problem, i lock the enumeration,
> passing the ArrayList instance to the lock.
> But i still get the same exception.
> Thanks for your help.
> Sharon.
>
>
这篇关于锁定问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文