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

Author Topic: Semaphore?  (Read 4287 times)

0 Members and 1 Guest are viewing this topic.

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Semaphore?
« on: October 06, 2010, 01:41:51 am »
Greetings,

Is there an equivalent as SDL_CondSignal (Restart a thread wait on a condition variable) within the SFML threads... Semaphore?

thx

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Semaphore?
« Reply #1 on: October 06, 2010, 08:04:45 am »
There's no semaphore and no wait condition in SFML (by the way, these two concepts are totally different). If you need this kind of features, you should use a more dedicated threading library.
Laurent Gomila - SFML developer

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Semaphore?
« Reply #2 on: October 06, 2010, 09:42:20 am »
Oh i see, that is very unfortunate... thx for pointing that out… just the wait condition would do… any library you would recommend beside SDL?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Semaphore?
« Reply #3 on: October 06, 2010, 10:20:27 am »
boost/std::thread is the most obvious choice. I don't know other threading libraries, but I'm sure there are many good ones available. It depends on what features you want.
Laurent Gomila - SFML developer

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Semaphore?
« Reply #4 on: October 07, 2010, 01:18:10 am »
Basically, I`m  trying to convert this tutorial:

http://dranger.com/ffmpeg/tutorial03.html

It’s been a nightmare so far… I`m astonish by the lack of support with this, for this tutorials being about 7 years old. I was hoping to make an SFML version. I think video playback would be a great plus for SFML. All it is missing is the equivalent of:

SDL_CondWait();
SDL_CondSignal();

would this be a valuable feature to implement?

With a little guidance setting the audio streaming, it shouldn’t take much to make this work. But I can’t make it happen by myself so far.

Still digging,

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Semaphore?
« Reply #5 on: October 07, 2010, 01:54:20 am »
And the rabbit hole goes deeper... std::thread(C++0x) is not implemented in VC++ 2010 and I`m not a fan of boost:: … at all.

I was hoping not to look back at SDL again…

WitchD0ctor

  • Full Member
  • ***
  • Posts: 100
    • View Profile
    • http://www.teleforce-blogspot.com
Semaphore?
« Reply #6 on: October 07, 2010, 01:59:23 am »
You can always use sf video player in the projects forum, easy to use. Only catch is it only supports theora format videos, which is a patent free codec
:o
John Carmack can Divide by zer0.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Semaphore?
« Reply #7 on: October 07, 2010, 08:26:16 am »
Quote
And the rabbit hole goes deeper... std::thread(C++0x) is not implemented in VC++ 2010 and I`m not a fan of boost:: … at all.

I was hoping not to look back at SDL again…

I can't believe that you can't find a threading library that suits your needs, if SFML doesn't provide it.
Laurent Gomila - SFML developer

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Semaphore?
« Reply #8 on: October 07, 2010, 05:18:40 pm »
It’s not that I can’t, I’d rather not too... keep library count to a minimum for maintainability sake. when it’s says SFML supports threading I didn’t expect it was partially supported. No worries, I went for a duo SFML / SDL until I find something more elegant.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Semaphore?
« Reply #9 on: October 08, 2010, 12:59:35 am »
Quote from: "golgoth"
And the rabbit hole goes deeper... std::thread(C++0x) is not implemented in VC++ 2010 and I`m not a fan of boost:: … at all.
But you are aware that the std::thread implementation will look pretty similar to boost::thread?

And Boost is used by many C++ programmers. I don't think it's generally a bad idea to create this dependency, as it also offers a lot of other libraries apart from multithreading. By the way, you could abandon SDL instead, so the dependency count is not really an argument.

Maybe you should give Boost a try, it consists of different libraries written by different developers. Or what exactly doesn't please you?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: