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

Author Topic: Flipped RenderTexture  (Read 10797 times)

0 Members and 2 Guests are viewing this topic.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Flipped RenderTexture
« Reply #15 on: February 02, 2012, 02:24:17 pm »
-> http://msdn.microsoft.com/en-us/library/windows/desktop/ms686298%28v=vs.85%29.aspx

The MSDN sleep documentation describes some of them. There are other resources on MSDN that describes more problems. Just "follow the paper
 trail" :P

One example:
Quote
Threads that are under concurrency control. For example, an I/O completion port or thread pool limits the number of associated threads that can run. If the maximum number of threads is already running, no additional associated thread can run until a running thread finishes. If a thread uses Sleep with an interval of zero to wait for one of the additional associated threads to accomplish some work, the process might deadlock.


Also the problem we had was with the actual scheduling that windows does. One thread was favored above the other ones but each of them was yielding. Our input thread for instance which was supposed to run much faster than all the other threads could be locked out completely and got only allowed to run sometimes which the user could feel. And no we didn't implement any locking mechanisms that could have caused it, changing from yielding to actually sleeping 1 ms limited us to a 1000 FPS but solved everything.

Any bug you are talking about, exist in Windows land out of our reach.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Silvah

  • Guest
Flipped RenderTexture
« Reply #16 on: February 03, 2012, 11:50:50 am »
Oh yeah. It's all awesome, except that:
Quote from: "Silvah"
And, uhm, the behavior of Sleep(0) is actually well-defined, so if you want something else, then you shouldn't blame Sleep(0) for that.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Flipped RenderTexture
« Reply #17 on: February 03, 2012, 03:10:25 pm »
Quote from: "Silvah"
Oh yeah. It's all awesome, except that:
Quote from: "Silvah"
And, uhm, the behavior of Sleep(0) is actually well-defined, so if you want something else, then you shouldn't blame Sleep(0) for that.


You mean this definition?
Quote
A value of zero causes the thread to relinquish the remainder of its time slice to any other thread that is ready to run. If there are no other threads ready to run, the function returns immediately, and the thread continues execution.


This is a new definition and doesn't apply to XP which is still largely used around the world so we have to use the "worst" case definition... Which is that it will only give up to to at least equal or higher priority threads. And nightmare scenarios could force your application into a stagnation problem.

Statistics from 2011 December:
Quote
Win7    Vista    Win2003    WinXP    Linux    Mac    Mobile
46.1%    5.0%    0.7%    32.6%    4.9%    8.5%    1.2%


That's the definition of Sleep 0 on Windows yes. POSIX don't have any defined behavior for sleep 0. Closest you can get is shed_yield. And still on windows, even if they do have a defined behavior for Sleep 0, they also have a lot of associated problems with this usage on Windows. That they themselves have documented.

And don't hi-jack threads.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio