473,320 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using The SyncLock Statement

Ram
Hey,
I have about 5 Shared variables, that I want to be locked for access when
they are written to.
I'v read in the MSDN about the SyncLock statement, and I'm prety sure that's
what I'm looking for,
But the SycLock statement requires a statement in it's decleration:
SyncLock <Statement>
MySharedMember=NewValue
End SyncLock
What the statement's supposed to be?
Thanks ahead

-- Ram
Nov 20 '05 #1
3 2639
Hi,

Synclock MyVariableName

End Synclock

Or

SyncLock gettype(MyClass)

End Synclock.
Ken
-----------------------

"Ram" <ni***@bezeqint.net> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl:
Hey,
I have about 5 Shared variables, that I want to be locked for access when

they are written to.
I'v read in the MSDN about the SyncLock statement, and I'm prety sure
that's
what I'm looking for,
But the SycLock statement requires a statement in it's decleration:
SyncLock <Statement>
MySharedMember=NewValue
End SyncLock
What the statement's supposed to be?
Thanks ahead

-- Ram


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004
Nov 20 '05 #2
Ram
Thanks alot!

--Ram
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:O6**************@TK2MSFTNGP11.phx.gbl...
Hi,

Synclock MyVariableName

End Synclock

Or

SyncLock gettype(MyClass)

End Synclock.
Ken
-----------------------

"Ram" <ni***@bezeqint.net> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl:
Hey,
I have about 5 Shared variables, that I want to be locked for access when
they are written to.
I'v read in the MSDN about the SyncLock statement, and I'm prety sure
that's
what I'm looking for,
But the SycLock statement requires a statement in it's decleration:
SyncLock <Statement>
MySharedMember=NewValue
End SyncLock
What the statement's supposed to be?
Thanks ahead

-- Ram


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004

Nov 20 '05 #3
you can use a dummy string var for that

Public ThreadLock As String = "Lock Me"

i use this in a multithreaded app to lock callback routines

this was a tip in Programming visual basic.Net from F. balena

and works fine for me

hth

M.Posseth [MCP]

"Ram" <ni***@bezeqint.net> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
Hey,
I have about 5 Shared variables, that I want to be locked for access when
they are written to.
I'v read in the MSDN about the SyncLock statement, and I'm prety sure that's what I'm looking for,
But the SycLock statement requires a statement in it's decleration:
SyncLock <Statement>
MySharedMember=NewValue
End SyncLock
What the statement's supposed to be?
Thanks ahead

-- Ram

Nov 20 '05 #4

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

Similar topics

4
by: Ram | last post by:
Hey, I have about 5 Shared variables, that I want to be locked for access when they are written to. I'v read in the MSDN about the SyncLock statement, and I'm prety sure that's what I'm looking...
10
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...
2
by: Eric Newton | last post by:
I find it curious that the Synclock...End Synclock do not emit a try finally as well... SyncLock Me Me.someOperation() End SyncLock I would expect to see in the generated code: try...
3
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,...
0
by: Johan Karlsson | last post by:
Hi all! I just need a true or false answer for this statement. Consider having a piece of code that boils down to this Dim a = new ArrayList SyncLock a SyncLock a a.Add("Something") End...
4
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...
2
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:...
1
by: Perecli Manole | last post by:
Can an Exit Sub statement in a SyncLock block cause any problems with the proper release of the locked resource or affect the Monitor's waiting queue in any way? Thanks Perry
2
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 ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.