Synclock

  • Thread starter Thread starter MS Newsgroups
  • Start date Start date
M

MS Newsgroups

Hi,

If i have a remoting component hosted on a server that exposes a method that
does some file IO operations, and i want to avoid this method to be run at
the same time from client applications to avoid file locks, can I use
synclock before the method is called from the client app to achieve this ?

Niclas
 
Niclas,
The code running on the server would need to do use 'Synclock' or one of the
other locks found in the System.Threading namespace.

SyncLock uses System.Threading.Monitor which locks the object locally (on
the client). The 'cost' of having Synclock locking remotely would be too
high, as SyncLock is used to keep two thread synchronized.

Hope this helps
Jay
 
Tom,

I am not sure i understand, should i use synclock in my threads on the
client side when instantiating the remoting object ? or is synclock to be
used on the server side

Thanks for helping out

Niclas
 
It can't be used for what you are trying to do, if you see Jay B. Harlow's
post, it explains how Remote SyncLocking is a great strain on resources, and
can't be implemented easily. The VB SyncLock is only local, and cannot be
used for what you are trying to do.

--
Happy to help,
-- Tom Spink
([email protected])

"Go down with your server"

http://dotnetx.betasafe.com >> On The Mend

Please respond to the newsgroup,
so all can benefit
 
Niclas,
You can use a synclock on the client side, only one client will honor them.

If you want to use synclock for the 'remoting object' itself, you will need
to use it on the server side itself.

Hope this helps
Jay
 
Back
Top