[Warning] Fiber in tango.core.Thread still bug, dont use it in any scientific calculation

Swer swer at yoyocowo.com.nb
Sat Dec 8 02:59:55 PST 2007


I open 50 threads in my project, each threads have one master fiber and one 
slave fiber. each salve fiber instance a LUA 5.1 lua_State*, A Lua api 
my_yield() calling D Tango Fiber yield in my script. Lua number is double 
type, and my master fiber will handle bothe network and DirectX. So there 
both master/slave firbers touch FP units. My program crash randomly when 
using Tango Fiber, but when using Win32 SwitchToFiber or Posix swapcontext 
theres no crash anymore.

I do trace on you code by OllyDbg, there is no any FP save/restore 
internally by C calling convention. Have u tried use your Fiber on any real 
world project before submit to Tango library?

> Have you tried testing this with any examples?  I'm fairly certain that 
> the FPU does actually do what it is supposed to.  If you will notice, the 
> calling convention on the method is extern(C), not extern(D).  As a 
> result, the C calling specification requires that the FPU state is saved 
> before any function call by the caller - not the callee.  As a result, 
> this method should work and moreover save a great deal of time.  Dumping 
> the FPU state is a rather costly operation, and best avoided if possible, 
> which is why the C calling convention works this way.
>
> If you can find code that breaks with the current Tango fiber 
> implementation, I'd be happy to make the necessary changes.





More information about the Digitalmars-d mailing list