473,320 Members | 1,883 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.

Critical Sections

Now that VB is multithreaded, are there any critical sections?
Thanks
Mark
Nov 21 '05 #1
7 3291
Can you be more specific ?

"Mark" <Ma**@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Now that VB is multithreaded, are there any critical sections?
Thanks
Mark

Nov 21 '05 #2

"Mark" <Ma**@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Now that VB is multithreaded, are there any critical sections?
Thanks


Every object has a Monitor which you can use to control concurrency. Only
one thread can enter a Monitor at a time.

VB has the SyncLock keyword to allow you to use a block of code to
enter/exit a Monitor.

Shared objects are shared among all object instances and threads, so any
shared object can be used like a critical section.

EG

class MyClass
public shared readonly SyncRoot as new Object()

public shared sub DoSomething()
SyncLock SyncRoot
'only one thread at a time in here
end SyncLock
end sub

end class

Nov 21 '05 #3
"Mark" <Ma**@discussions.microsoft.com> schrieb:
Now that VB is multithreaded, are there any critical sections?


Take a look at 'SyncLock' and the 'Monitor' class.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4

"Herfried K. Wagner [MVP]"
..
Now that VB is multithreaded, are there any critical sections?


Take a look at 'SyncLock' and the 'Monitor' class.

Are you sure that that is all?

I think that I have to disagree with you about that.

Cor
Nov 21 '05 #5
"Cor Ligthert" <no************@planet.nl> schrieb:
Now that VB is multithreaded, are there any critical sections?


Take a look at 'SyncLock' and the 'Monitor' class.

Are you sure that that is all?

I think that I have to disagree with you about that.

?!?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #6

"Herfried K. Wagner [MVP]" <hi***************@gmx.at>
"Cor Ligthert" <no************@planet.nl> schrieb:
Now that VB is multithreaded, are there any critical sections?

Take a look at 'SyncLock' and the 'Monitor' class.

Are you sure that that is all?

I think that I have to disagree with you about that.


When you read your message you can get the idea that you say that this are
the only critical things, I think that is not right, therefore just to
protect you a little bit.

The only thing you had to write was, no I did not mean that.

Cor
Nov 21 '05 #7
"Cor Ligthert" <no************@planet.nl> schrieb:
> Now that VB is multithreaded, are there any critical sections?

Take a look at 'SyncLock' and the 'Monitor' class.

Are you sure that that is all?

I think that I have to disagree with you about that.


When you read your message you can get the idea that you say that this are
the only critical things, I think that is not right, therefore just to
protect you a little bit.


"Critical section" is a term with a special meaning in the field of process
synchronization/"multithreading".

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #8

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

Similar topics

77
by: Charles Law | last post by:
Hi guys I have a time critical process, running on a worker thread. By "time critical", I mean that certain parts of the process must be completed in a specific time frame. The time when the...
2
by: Xarky | last post by:
Hi, I am trying to learn Critical Sections. I have written a small program. Source code problem below. What the program is doing is disabling the CRTL-C signal in the critical section. My...
7
by: Piotrek Stachowicz | last post by:
Hi, I need to create the situation in my system, where no more critical sections can be initialized (win2000Server). I thought about creating a simple c# application and using the Monitor class....
6
by: MPH Computers | last post by:
Hi I am looking for some help on Threading and Critical Sections I have a main thread that controls an event the event handler creates a new thread for carrying out the work because the...
13
by: Hendrik van Rooyen | last post by:
Hi, I would like to do the following as one atomic operation: 1) Append an item to a list 2) Set a Boolean indicator It would be almost like getting and holding the GIL, to prevent a...
5
by: =?Utf-8?B?VmFubmk=?= | last post by:
Hi, I have a component where I need to have thread-safe access to a list. Operations on the list are done in critical sections (lock (lockObject) { ... } ) in the usual way, to make sure that no...
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
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...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...

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.