473,386 Members | 1,698 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,386 software developers and data experts.

How to use EnterCriticalSection and LeaveCriticalSection in C#?

How to use EnterCriticalSection and LeaveCriticalSection in C#?
How to define CRITICAL_SECTION?
Nov 15 '05 #1
2 6350
Hi,

I think you should look at Monitor class (Enter, Exit methods).

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"afatdog" <af********@yeah.net> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
How to use EnterCriticalSection and LeaveCriticalSection in C#?
How to define CRITICAL_SECTION?

Nov 15 '05 #2
You might want to look at the lock statement too.

(from MSDN)
lock ensures that one thread does not enter a critical section while another
thread is in the critical section of code. If another thread attempts to
enter a locked code, it will wait (block) until the object is released.
--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"afatdog" <af********@yeah.net> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
How to use EnterCriticalSection and LeaveCriticalSection in C#?
How to define CRITICAL_SECTION?

Nov 15 '05 #3

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

Similar topics

8
by: Marc Leclerc | last post by:
Would anyone have a hint of what's wrong with this static char szLocalInternetAddress; DWORD dwTest = 0x0002; g_DmsLog.CreateEntry("Test with DWORD: %ld", dwTest);...
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...
9
by: Arsalan Ahmad | last post by:
Hi all, I have developed a static library which I am using in one of my application. In my library I have created my own heap and all the objects (class objects) in my application are created in...
2
by: tikcireviva | last post by:
Hi Guys, I've done a mulithread queue implementation on stl<queue>, my developement environment is on VC6 as well as FC3. Let's talks about the win32 side. The suspected memory leak is find...
7
by: Ziyan | last post by:
I am writing a C/C++ program that runs in background (Linux). Therefore, normally no output would be written into standard output. However, sometimes I want to have debug message collected and sent...
5
by: Lagarde Sébastien | last post by:
Hello, I write code to debug new call with following macro: #define new (MemoryManager::Get().setOwner (__FILE__, __LINE__, _FUNCTION-), FALSE) ? NULL : new The setOwner allow to save the...
3
by: =?Utf-8?B?dGhlamFja29mYWxs?= | last post by:
I have a few global variables and a function that gets called multiple times to complete a single transaction and uses the variables. The function gets different notifications. When the function...
1
kreagan
by: kreagan | last post by:
I have software for a BERT that networks with a external database (SMU). The program requests information from the SMU and waits for a response. Sometimes, the software hangs while waiting for the...
29
by: NvrBst | last post by:
I've read a bit online seeing that two writes are not safe, which I understand, but would 1 thread push()'ing and 1 thread pop()'ing be thread-safe? Basically my situation is the follows: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...

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.