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

Question about mutexes

In OS/2 C, I would do this:

main()
{
....
DosCreateMutexSem(NULL, &hmtx, 0UL, FALSE);
....
}

thread()
{
....
DosRequestMutexSem(hmtx);

Locked!

DosReleaseMutexSem(hmtx);
....
}

How would I go about doing that in Python?

I figured this part out:

lockobj = mutex()

lockobj.lock(foo, "bar")

Locked!

lockobj.unlock()
Now, what (and more importantly: WHY?!) - is foo and "bar" for?

I have written a dummyfunction for foo which does nothing when
called, but I fail to see the point of its existence. Could someone
provide an example when this would be useful?
Jul 19 '05 #1
2 1480
Jan Danielsson wrote:
In OS/2 C, I would do this:

main()
{
...
DosCreateMutexSem(NULL, &hmtx, 0UL, FALSE);
...
}

thread()
{
...
DosRequestMutexSem(hmtx);

Locked!

DosReleaseMutexSem(hmtx);
...
}

How would I go about doing that in Python?


I think you will want to create a threading.Lock object.

Reinhold
Jul 19 '05 #2
Reinhold Birkenfeld wrote:
[---]
How would I go about doing that in Python?


I think you will want to create a threading.Lock object.


It would seem so. Thanks for the tip!
Jul 19 '05 #3

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

Similar topics

9
by: Tim Rentsch | last post by:
I have a question about what ANSI C allows/requires in a particular context related to 'volatile'. Consider the following: volatile int x; int x_remainder_arg( int y ){ return x % y; }
7
by: | last post by:
q: void producer() { while(1) { GeneratePacket(); PutPacketIntoBuffer(); Signal(customer); } }
2
by: QQ | last post by:
Hi I am writing a multithreads program. I have a variable in the main thread, can I use it at the child thread? For example I have a count in main, when the count reaches 10, I will execute some...
5
by: Michael A. Covington | last post by:
What is the difference between myMutex.WaitOne(n,false); and myMutex.WaitOne(n,true); where n is a number of milliseconds and myMutex is a Mutex?
17
by: Arun Kumar | last post by:
What is wrong with this code. All i am trying to test is 3 progressbar and one button. On buttonclick i create 3 threads and each thread calls a method which in turn updates the progressbar and it...
2
by: UJ | last post by:
Is there a way to get a list of all the mutexes that have already been defined? TIA - Jeff.
7
by: drawoh | last post by:
Hi All, I have a class that creates a thread, a mutex and a condition variable in its constructor. I am writing a copy constructor for this class in C++. I am doing a simple copy using the...
6
by: John | last post by:
Hi I am preparing the second major version of an app. The project is a copy of version 1 which has change made to it. What changes do I need to do for setup for v2 not tell me that there is...
3
by: pbd22 | last post by:
Hi. I have a C# program that fires an external VB6 program which writes to a file and terminates. It is ugly, but this is how I have to do it. I cannot change this part of the program. The...
8
by: Raxit | last post by:
Hi, In Mulithreaded program, using Posix api, we do pthread_mutex_lock(&Lock)
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...
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...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.