panne       2002/06/30 13:59:59 PDT

  Modified files:
    libraries/GLUT       Makefile 
    libraries/GLUT/Graphics/UI/GLUT/Callbacks Global.hs Window.hs 
  Added files:
    libraries/GLUT/Graphics/UI/GLUT/Callbacks Registration.hs 
  Log:
  After it was concluded on the FFI mailing list that freeing a FunPtr during the
  callback itself is not a good idea, we bite the bullet and do it the hard (and
  cunning :-) way:
  
     * Because GLUT has no way to query callbacks, the FunPtrs to them are tracked
       in global(!) table, using the standard unsafePerformIO-newIORef-trick.
  
     * When an already existing callback is re-/unregistered, the old FunPtr to it
       is put onto a cleanup list, which is again held in a global variable.
  
     * When the cleanup list becomes non-empty, a scavenger is registered as an
       immediate timer callback, which frees all FunPtrs on the cleanup list. The
       FunPtr to the scavenger is held in a global (write-once) variable, but this
       probably comes to no surprise...   :-}
  
  This all works without any synchronisation because GLUT is single-threaded, so
  all callbacks are done sequentially.
  
  Revision  Changes    Path
  1.9       +7 -5      fptools/libraries/GLUT/Makefile
  1.2       +9 -18     fptools/libraries/GLUT/Graphics/UI/GLUT/Callbacks/Global.hs
  1.3       +3 -13     fptools/libraries/GLUT/Graphics/UI/GLUT/Callbacks/Window.hs
_______________________________________________
Cvs-libraries mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-libraries


Reply via email to