Re: lock used in thread and by event
- From: uupi_duu@xxxxxxxxx
- Date: Tue, 25 Sep 2007 04:54:40 -0700
No, this is the issue: first thread is using a method X that uses
lock(X).
Second thread is fireing an event that executes first threads method
that
also uses lock(X).
So is this situation same like e.g. one and only thread is calling
lock(X)
two times and it does not block?
To clearify again ;) is Event call from one thread to another threads
method that uses lock(X) {...} like Java's ReentrantLock?
Cheers!
On 25 syys, 14:45, "Jon Skeet [C# MVP]" <sk...@xxxxxxxxx> wrote:
On Sep 25, 12:37 pm, uupi_...@xxxxxxxxx wrote:
Hello, I can't post the program but code was in previous posting.
Well *some* code was in the previous posting - but nothing to show
what threads are doing what, etc.
But what I would like to know is that is event call executed in caller
thread's context or in the context of that thread were the event
handler code is?
The caller. There's no such thing as "the thread where the event
handler code is".
To clearify: is event call
same as a method call and executed in context of the thread which has
the actual event handler?
Yes.
So, is my example of two different threads using event and same lock-
variable in first thread same thing that what happends when one thead
calls lock(this) too times sequentially (and it does
not start waitiing in second lock call).
It depends on what you mean by "two different threads using event". It
would be *much* easier to talk about this if you could write a short
but complete example. It doesn't need to be your real code - just code
we can talk about.
Jon
.
- Follow-Ups:
- Re: lock used in thread and by event
- From: Jon Skeet [C# MVP]
- Re: lock used in thread and by event
- References:
- lock used in thread and by event
- From: uupi_duu
- Re: lock used in thread and by event
- From: Jon Skeet [C# MVP]
- Re: lock used in thread and by event
- From: uupi_duu
- Re: lock used in thread and by event
- From: Jon Skeet [C# MVP]
- lock used in thread and by event
- Prev by Date: date picker problem
- Next by Date: Re: lock used in thread and by event
- Previous by thread: Re: lock used in thread and by event
- Next by thread: Re: lock used in thread and by event
- Index(es):
Relevant Pages
|
Loading