Stefan is right here.

- It's not surprising that with -Onot you get different code from different 
source programs, even if one can readily be transformed into the other.  That's 
what -O does.

| If anything I think it's a bug in the code generator/the runtime.  We
| shouldn't be generating uninterruptable loops!
|
| Option 1: Don't generate non-allocating loops.
|
| Option 2: Preempt non-allocating loops.

I would urge caution on (2).  It's an absolute swamp, especially when you want 
to be portable across platforms, into which many have ventured but few have 
re-emerged.   Those that have usually do so by adopting some variation on 
Option 1.

However you can do (1) without allocating: you just need to insert a test into 
the loop that tests the "please yield" flag, which is set by the interrupt.  
The  key thing is that the thread yields voluntarily and tidily rather than 
being forcibly pre-empted.

Simon
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to