Skip to main content
GameDev.net gamedev.net
🔒 Locked

Stepping Into Fiber

Started by Shannon Barber Oct 26, 2005 at 10:13 AM 5 replies 2.1k views
Original Post
Shannon Barber
Shannon Barber
I've written some code that uses Win32 Fibers and when I come to a SwitchToFiber API call, I really want to follow it to the activated Fiber. Does MSVC have any Fiber debugging capabilities I'm missing?
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Promit
Promit
This has nothing to do with your problem, but I'm curious what the fibers are for? The MSDN docs seem to suggest that they're merely a convenience for porting apps that use user threads and schedule them manually, and should be avoided otherwise.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
ApochPiQ
ApochPiQ
MSVC (both 6.0 and the .Net versions) do indeed support switching the currently debugged thread, although I've had mixed results with threads that are manually suspended and resumed at run time (as opposed to being directly blocked with synchronization calls, for instance). As for fibers... what Promit said.
duke
duke
Quote:
Original post by Promit
This has nothing to do with your problem, but I'm curious what the fibers are for? The MSDN docs seem to suggest that they're merely a convenience for porting apps that use user threads and schedule them manually, and should be avoided otherwise.


You are correct about one thing, they are basically threads you can schedule yourself. If you need that ability then they are useful. I wouldn't say you should avoid them though. "Use the right tool for the job"
super genius
Promit
Promit
Quote:
Original post by duke
Quote:
Original post by Promit
This has nothing to do with your problem, but I'm curious what the fibers are for? The MSDN docs seem to suggest that they're merely a convenience for porting apps that use user threads and schedule them manually, and should be avoided otherwise.


You are correct about one thing, they are basically threads you can schedule yourself. If you need that ability then they are useful. I wouldn't say you should avoid them though. "Use the right tool for the job"
Well, the thing is, I'm skeptical of why you would ever need to (or want to) schedule threads yourself. Since I do know Shannon's a bright guy, I am curious about what's going on.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Shannon Barber
Shannon Barber
I ported an RTOS to Win32 :)

I initially tried to make each task its own thread but this worked out very poorly. I had a lot of trouble trying to control which task thread was allowed to run (using SuspendThread & ResumeThread) with race conditions. After three or four 'fixes' to try to make the switches atomic I remembered Fibers and that you controlled exactly when you switched between them (atomic task swap).

Everything runs smoothly now since there's no race conditions and everything is syncronous and very deterministic. Or at least it did until I tried to run code coverage... which died horribly and now I'm trying to debug it.
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.