Synclock in IIS Hosted Remoting - Single Threading Function Call?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
Back
Top