Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ccfreak2k

Pages: [1]
1
General discussions / Re: trylock() patch
« on: January 06, 2014, 02:36:27 am »
  • If SFML "does not try to be an concurrency library," why does it have a Mutex class in the first place? The existing one is a wrapper for the system libraries anyway, and both Windows and Linux (pthread users, anyway) have both lock and trylock, but only the former is exposed by SFML.
  • Not everyone is using C++11, though the number of projects using it grows every day.
  • I have no expectation for it to be officially included; I'm simply offering it as a patch for anyone that desires this functionality.

I only made this to add what I thought was lacking in the library. Where there is lock() there should be trylock() as well...and now there is.

2
General discussions / trylock() patch
« on: January 05, 2014, 11:49:24 pm »
Since SML's Mutex class was lacking a trylock() method, I've decided to add one since I didn't want to drag in an entire new library just for that. Haven't been able to test the patch yet since I'm trying to build SFML still, but I think it should work. Still, caveat emptor. Would appreciate someone on Linux checking it since I'm on Windows.

Worth noting is that the return value is based on TryEnterCriticalSection(), so "true" means the mutex was locked and "false" means it was not, even on Unix platforms.

Pages: [1]
anything