We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1623

Summary: new SDL_MutexTryLock API
Product: SDL Reporter: Edward Rudd <urkle>
Component: threadAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2 CC: icculus
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: Implementation of MutexTryLock for all supported platforms.
quick fix for pthread TryLock implementation
Reworked patch with different naming.

Description Edward Rudd 2012-10-17 12:32:37 UTC
Created attachment 972 [details]
Implementation of MutexTryLock for all supported platforms.

This new API method allows a TryLock concept to be applied to a Mutex..  This will attempt to lock the mutex, and if someone else has it locked will return SDL_MUTEX_TIMEDOUT to let the caller know that it's locked elsewhere.


I have included implementations for generic, nds, windows, and pthread.  (seems to be all of the implementations I needed to implement)
Comment 1 Edward Rudd 2012-10-17 13:54:14 UTC
Created attachment 975 [details]
quick fix for pthread TryLock implementation

Ok I forgot to add a #include <errno.h>..  So it's added and this now works on OSX/Linux
Comment 2 Edward Rudd 2013-01-01 12:57:40 UTC
Created attachment 1007 [details]
Reworked patch with different naming.

This patch renamed the method to SDL_TryLockMutex to be consistent with the current mutex method names. and combines the two patches into one.
Comment 3 Ryan C. Gordon 2013-01-02 08:39:52 UTC
Sam, any objections to this patch? I think it's worth including.

--ryan.