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

Semaphores

Hi, I'm doing an IT degree at university, and my lecturer's do not teach
m$ technologies. I was wondering if anyone could point me to the
implementation of mutex's and semaphores in .net? Or the microsoft
equivalent of them.
Apr 9 '06 #1
5 2594
Try reading Jon Skeet's article on multithreading in .NET:

http://www.yoda.arachsys.com/csharp/threads/

Apr 9 '06 #2
Steven,
If you want to see the actual code for the implementation of Mutex,
Semaphore, etc. , download yourself a copy of Lutz Roeder's free Reflector
product, Load MsCorlib, and use the built - in disassembler to see the actual
code in your favorite language.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Steven Spencer" wrote:
Hi, I'm doing an IT degree at university, and my lecturer's do not teach
m$ technologies. I was wondering if anyone could point me to the
implementation of mutex's and semaphores in .net? Or the microsoft
equivalent of them.

Apr 9 '06 #3
I'm afraid this will not work for him, since they are implemented in .NET
framework by calling WinAPI.
And Semaphore class is in System.dll, not in mscorlib.

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:72**********************************@microsof t.com...
Steven,
If you want to see the actual code for the implementation of Mutex,
Semaphore, etc. , download yourself a copy of Lutz Roeder's free Reflector
product, Load MsCorlib, and use the built - in disassembler to see the
actual
code in your favorite language.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Steven Spencer" wrote:
Hi, I'm doing an IT degree at university, and my lecturer's do not teach
m$ technologies. I was wondering if anyone could point me to the
implementation of mutex's and semaphores in .net? Or the microsoft
equivalent of them.

Apr 9 '06 #4
Yes, Semaphore is in System.Dll, and Mutex is in MsCorLib. And even though
WinAPI calls are used, you can still decompile to C# for example and examine
quite easily how everything is implemented, including any DLLImport
signatures.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Lebesgue" wrote:
I'm afraid this will not work for him, since they are implemented in .NET
framework by calling WinAPI.
And Semaphore class is in System.dll, not in mscorlib.

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:72**********************************@microsof t.com...
Steven,
If you want to see the actual code for the implementation of Mutex,
Semaphore, etc. , download yourself a copy of Lutz Roeder's free Reflector
product, Load MsCorlib, and use the built - in disassembler to see the
actual
code in your favorite language.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Steven Spencer" wrote:
Hi, I'm doing an IT degree at university, and my lecturer's do not teach
m$ technologies. I was wondering if anyone could point me to the
implementation of mutex's and semaphores in .net? Or the microsoft
equivalent of them.


Apr 9 '06 #5
Here is one I did before 2.0 was out:
http://www.codeproject.com/csharp/Di...sp#xx1205311xx

--
William Stacey [MVP]

"Steven Spencer" <Sp****@spinalogic.ws> wrote in message
news:44********@dnews.tpgi.com.au...
| Hi, I'm doing an IT degree at university, and my lecturer's do not teach
| m$ technologies. I was wondering if anyone could point me to the
| implementation of mutex's and semaphores in .net? Or the microsoft
| equivalent of them.
Apr 10 '06 #6

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

Similar topics

1
by: Nish | last post by:
Hi, I have some code, to which I added usage of posix semaphores. I am working on a solaris platform. After doing that, my process becomes unkillable, that is it will not terminate if sent a...
1
by: Mehmet Turker | last post by:
Hi; In a research project, I want to use shared memory with semaphores. First I have to create an environment for interprocess messaging. I'm thinking of having a main process which creates a big...
2
by: schneider jp | last post by:
Hi everybody For a project of system programming, we need to use semaphores, but i got some pbs... when I compile, i get perror with sem_open("machin", O_CREAT, 0666, 0); and perror says...
11
by: FiLH | last post by:
Hello, I would like to know if posix semaphores are inter processes or just semaphores for threads inside the same process. I have not seen it defined in the posix specification I have found,...
1
by: jinksk | last post by:
I have a C# application and a VB6 application that need to share a dialup connection to the internet. Don't ask why, this is one of those corporate "do or die" things. The only way I can see to...
1
by: Edwin New | last post by:
I have a requirement to run two separate postmasters on the one machine. It looks like they compete for resources (semaphores) so won't run concurrently. I compiled twice, specifying different...
0
arne
by: arne | last post by:
Hi, I am using Perl ithreads. The threads I create shall access a shared hash. In order to control access to the hash, I would like to use a semaphore. (BTW, does the hash need the protection at...
0
by: The Advocate | last post by:
Hello, how can we implement semaphores using monitors. I got how we can do it the way round. I did alot of search but couldnt find any implementation of semaphores using monitors,. Can anyone help me...
5
by: davidcollins001 | last post by:
Hi, Firstly please excuse the long ramblingness. I need some conceptual help, I am trying to make two programs that are exactly the same but take it in turns to execute something, so the output...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.