Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - returning to calle from a critical region

Reply
 
Old 06-12-2009   #1 (permalink)
deostroll


 
 

returning to calle from a critical region

There is a remote method that returns a datatable to the client. I a
talking of a scenario when there are multiple requests which invoke
the same method. I have a synchronized region of code. By that I mean
only one thread/request should execute that code; others should wait.
I've written simply with a lock. My doubt is that I am doing a return
within that region. Will this release the lock on the synchronized
region?

lock(Handle)
{
//some fetching logic here

//returning datatable
return myDataTableObj;
}


--deostroll

My System SpecsSystem Spec
Old 06-13-2009   #2 (permalink)
pennanth


 
 

Re: returning to calle from a critical region

Definetely, it will release the lock.

Lock is defined as try { } finally { } block, so, the lock is always
released in finally section.

Cheers,
pennanth

On Sat, 13 Jun 2009 00:01:29 +1000, deostroll <deostroll@xxxxxx> wrote:
Quote:

> There is a remote method that returns a datatable to the client. I a
> talking of a scenario when there are multiple requests which invoke
> the same method. I have a synchronized region of code. By that I mean
> only one thread/request should execute that code; others should wait.
> I've written simply with a lock. My doubt is that I am doing a return
> within that region. Will this release the lock on the synchronized
> region?
>
> lock(Handle)
> {
> //some fetching logic here
>
> //returning datatable
> return myDataTableObj;
> }
>
>
> --deostroll

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
My System SpecsSystem Spec
Old 06-13-2009   #3 (permalink)
deostroll


 
 

Re: returning to calle from a critical region

On Jun 13, 11:41*am, pennanth <penna...@xxxxxx> wrote:
Quote:

> Definetely, it will release the lock.
>
> Lock is defined as try { } finally { } block, so, the lock is always *
> released in finally section.
>
cool. Thanx
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
DVD Region Incorrect Vista General
Blu ray region code. Media Center
dvd region problems Vista hardware & devices
No DVD Region Tab Vista hardware & devices


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46