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 - new SDL_MutexTryLock API
Summary: new SDL_MutexTryLock API
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: thread (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 enhancement
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-17 12:32 UTC by Edward Rudd
Modified: 2013-03-05 18:57 UTC (History)
1 user (show)

See Also:


Attachments
Implementation of MutexTryLock for all supported platforms. (4.92 KB, patch)
2012-10-17 12:32 UTC, Edward Rudd
Details | Diff
quick fix for pthread TryLock implementation (533 bytes, patch)
2012-10-17 13:54 UTC, Edward Rudd
Details | Diff
Reworked patch with different naming. (5.03 KB, patch)
2013-01-01 12:57 UTC, Edward Rudd
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.