[Patches] [ python-Patches-474500 ] Make OS/2 locks work like posix locks

noreply@sourceforge.net noreply@sourceforge.net
Tue, 30 Oct 2001 09:40:10 -0800


Patches item #474500, was opened at 2001-10-24 08:14
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=474500&group_id=5470

Category: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Michael Muller (mikemuller)
>Assigned to: Tim Peters (tim_one)
Summary: Make OS/2 locks work like posix locks

Initial Comment:
This is a fix for a long-standing OS/2 bug.

OS/2 locks are currently based on OS/2 mutex
semaphores, which behave more like reentrant locks than
posix locks.  For example, under OS/2:

>>> l = thread.allocate_lock()
>>> l.acquire()
>>> l.acquire()
>>>

The second acquire() doesn't block, as it would under
posix platforms, because the underlying OS/2 mutex
recognizes that the thread already has the lock and
simply increments the ownership count.

This patch reimplements locks using OS/2 event
semaphores and critical sections so that they behave
like their posix counterparts.

This patch will conflict with Andrew MacIntyre's
changes for OS/2 EMX.  If his patch is applied first,
I'll resubmit this.



----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-10-30 09:40

Message:
Logged In: YES 
user_id=31435

Assigned to me.

----------------------------------------------------------------------

Comment By: Andrew I MacIntyre (aimacintyre)
Date: 2001-10-30 04:08

Message:
Logged In: YES 
user_id=250749

I've looked at this, and with the caveat that I'm not up with threads in general let alone OS/2 threads in particular, would 
recommend applying this patch on the following basis:-
1) the patch applies only to Python/thread_os2.h - a file specific to the OS/2 ports;
2) it is from the only person to my knowledge to have shown an interest in the VAC++ port, which is the only OS/2 port
currently supported by the CVS codebase, and this person appears to have a reasonable grasp of the platform specific 
issue prompting the change;
3) as the maintainer of the other OS/2 port (EMX/GCC), I can fit in with the proposed patch when it comes time to add the 
EMX port changes to CVS.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=474500&group_id=5470