HighTechTalks DotNet Forums  

Synclock in IIS Hosted Remoting - Single Threading Function Call?

Dotnet Framework (Remoting) microsoft.public.dotnet.framework.remoting


Discuss Synclock in IIS Hosted Remoting - Single Threading Function Call? in the Dotnet Framework (Remoting) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Spam Catcher
 
Posts: n/a

Default Synclock in IIS Hosted Remoting - Single Threading Function Call? - 02-27-2007 , 11:03 PM






Hi all,

I'm hosting a remoting service in IIS. I have a function which I only want
one concurrent access at a time. Will this prevent multiple users from
accessing the function at a paritcular time?

'Empty object used for sync locking purposes
Private Shared MySyncLockObject as new Object

'Only want 1 user to acces function at a time
Public Sub SingleThreadedSubProcedure
Synclock MySyncLockObject
'Code in here...
End Synclock
End Sub

Will Synclock globally restrict access to the sub to a single thread at a
time?

Reply With Quote
  #2  
Old   
msgroup
 
Posts: n/a

Default Re: Synclock in IIS Hosted Remoting - Single Threading Function Call? - 03-01-2007 , 08:36 AM






Hi, Spam Catcher:

Two key points for multithreading programming:

1. Make sure that you need to lock MySyncLockObject everywhere, if
you want to access the variable from different threads.

2. Make sure that you need to release lock as early as possible so
that thread contention is reduced to the lowest level. This requires you to
have clear understanding of your business requirements, and design a good
locking algorithm. If your locking algorithm is not well designed and coded,
you will find your server application doesn't support mutlithreading (or
multi-core) well. This is the most challenge aspect in multithreading
programming.

Regards,

Do you know batching, asynchrony and parallel computation with online
compression? See the sample project SocketPro at www.udaparts.com





"Spam Catcher" <spamhoneypot (AT) rogers (DOT) com> wrote

Quote:
Hi all,

I'm hosting a remoting service in IIS. I have a function which I only want
one concurrent access at a time. Will this prevent multiple users from
accessing the function at a paritcular time?

'Empty object used for sync locking purposes
Private Shared MySyncLockObject as new Object

'Only want 1 user to acces function at a time
Public Sub SingleThreadedSubProcedure
Synclock MySyncLockObject
'Code in here...
End Synclock
End Sub

Will Synclock globally restrict access to the sub to a single thread at a
time?



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.