473,662 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Synclock

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
Nov 19 '05 #1
5 5439
Niclas,
The code running on the server would need to do use 'Synclock' or one of the
other locks found in the System.Threadin g namespace.

SyncLock uses System.Threadin g.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

"MS Newsgroups" <li************ *@hotmail.com> wrote in message
news:ew******** ******@TK2MSFTN GP12.phx.gbl...
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

Nov 19 '05 #2
Hi, SyncLock is only for your threads running in your assembly and the
objects exposed in your assembly.

--
Happy to help,
-- Tom Spink
(th**********@n tlworld.com)

"Go down with your server"

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

Please respond to the newsgroup,
so all can benefit
"MS Newsgroups" <li************ *@hotmail.com> wrote in message
news:ew******** ******@TK2MSFTN GP12.phx.gbl...
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

Nov 19 '05 #3
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
"Tom Spink" <th**********@n tlworld.com> wrote in message
news:OM******** ******@TK2MSFTN GP12.phx.gbl...
Hi, SyncLock is only for your threads running in your assembly and the
objects exposed in your assembly.

--
Happy to help,
-- Tom Spink
(th**********@n tlworld.com)

"Go down with your server"

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

Please respond to the newsgroup,
so all can benefit
"MS Newsgroups" <li************ *@hotmail.com> wrote in message
news:ew******** ******@TK2MSFTN GP12.phx.gbl...
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


Nov 19 '05 #4
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
(th**********@n tlworld.com)

"Go down with your server"

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

Please respond to the newsgroup,
so all can benefit
"MS Newsgroups" <li************ *@hotmail.com> wrote in message
news:#z******** ******@TK2MSFTN GP09.phx.gbl...
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
"Tom Spink" <th**********@n tlworld.com> wrote in message
news:OM******** ******@TK2MSFTN GP12.phx.gbl...
Hi, SyncLock is only for your threads running in your assembly and the
objects exposed in your assembly.

--
Happy to help,
-- Tom Spink
(th**********@n tlworld.com)

"Go down with your server"

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

Please respond to the newsgroup,
so all can benefit
"MS Newsgroups" <li************ *@hotmail.com> wrote in message
news:ew******** ******@TK2MSFTN GP12.phx.gbl...
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



Nov 19 '05 #5
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

"MS Newsgroups" <li************ *@hotmail.com> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
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
"Tom Spink" <th**********@n tlworld.com> wrote in message
news:OM******** ******@TK2MSFTN GP12.phx.gbl...
Hi, SyncLock is only for your threads running in your assembly and the
objects exposed in your assembly.

--
Happy to help,
-- Tom Spink
(th**********@n tlworld.com)

"Go down with your server"

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

Please respond to the newsgroup,
so all can benefit
"MS Newsgroups" <li************ *@hotmail.com> wrote in message
news:ew******** ******@TK2MSFTN GP12.phx.gbl...
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



Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
3048
by: Keith Langer | last post by:
I have some questions about whether synclock is necessary in a few different scenarios: 1) I have a Queue class which is shared between two threads. Thread 1 pushes objects onto the queue and Thread 2 pops objects off the queue one at a time (with no enumerators - just first in, first out). Does the Queue class need to be synclocked when objects are pushed on or popped off? 2) I have a boolean variable which can be read or written...
4
3786
by: fred | last post by:
If I have multiple threads running a Sub as below then a number of threads can be held up at the SyncLock. When it becomes free which thread goes first. Is it just by chance which thread goes first or do the threads queue in a FIFO or perhaps a LIFO bases. Thanks Fred Sub SomeWork()
10
3155
by: Bob Day | last post by:
Using vs 2003, vb.net sql msde.. Consider the following code snippets. See **** for questions. All are shared and accessed by multiple threads simultaneiously. ' Instantiate per for this shared class Private Shared gcCDsd As New Class_Component_Designer
3
2128
by: Bob Day | last post by:
Ok, I have done a lot of reading(of the newsgroup answers, help files and MSDN articles) of synclock. I understand what you are saying in the newsgroup, and it is very helpful. It does, however, directly contradict what the VS 2003 help file says, and it seems that various posters to my original questions on Synclock disagree with each other. It seems, that the best practice is to use sysnlock to protect code, not variables. That...
4
1967
by: Jeff Stewart | last post by:
Specifically, I don't understand the parameter that Synclock accepts. How is a reference type a lockable entity? What -is- a reference type? Is it a number? Is it a value at a specific memory location? Does synclocking a reference type put an entry in a catalog somewhere in the system, and it's removed on the "end synclock" statement? Are there any guidelines for creating synclock objects? I've found a surprisingly small amount of...
7
1623
by: SD | last post by:
I have a public object that I only want one thread to access at a time. However the access to this object is not limited to one procedure. Will SyncLock work in this case? If not what options do I have? Thanks SD Code in Module public A as Collection
1
565
by: fred | last post by:
I have a VB application that is using MS Access as its database. To avoid connection delays the application creates one connection to the database at start-up and maintains that single connection throughout until the application closes. I now want to use multithreading to improve the feel of the application but I need some help understanding Synclock. The aim here is to prevent any two threads from trying to use the same connection at the...
3
4784
by: Chris Dunaway | last post by:
I was using a Queue object like this to create my own specialized queue class for use with my own objects: Public Class MySpecializedQueue Private q As New Queue Public Sub Enqueue(obj As MyCustomClass) SyncLock q.SyncRoot q.Enqueue(obj)
2
1738
by: j3ko | last post by:
Hi, I'm trying to start a thread that constantly iterates through an arraylist of items that the main thread adds and removes from...how would I accomplish this? Here's the gist of what I have: (can anybody give me pointers on what i'm doing wrong?) Class SecondThread aList as new arraylist innerthread as new thread(addressof task)
2
10048
by: HONOREDANCESTOR | last post by:
I have a buffer that needs to be locked sometimes, because 2 processes update it. So I made the buffer into a class and whenever there is code that affects it, I sandwich the code between Synclock MyBufferClass ........... End Synclock My question is, what is Synlock protecting? Is it just protecting
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.