Axel Simon <axel.si...@in.tum.de> writes:

> Hi Andy,
>
> On 31.01.2010, at 18:26, Andy Stewart wrote:
>
>> Hi Axel,
>>
>> unsafeInitGUIForThreadedRTS there is still a necessary? Even you have
>> fix this problem?
>>
>> If unsafeInitGUIForThreadedRTS is not necessary, we should remove
>> `unsafeInitGUIForThreadedRTS` and allowed use `-threaded` flag with
>> `initGUI` directly.
>>
>> Current, if i use `initGUI` with `-threaded` flag, will got error:
>>
>> ------------------------------> error start <------------------------------
>> initGUI: Gtk+ is single threaded and so cannot safely be used from
>> multiple Haskell threads when using GHC's threaded RTS. You can
>> avoid this error by relinking your program without using the
>> '-threaded' flag. If you have to use the threaded RTS and are
>> absolutely sure that you only ever call Gtk+ from a single OS
>> thread then you can use the function: unsafeInitGUIForThreadedRTS
>> ------------------------------> error end   <------------------------------
>>
>> What do you think?
>
> Actually, the semantics of multi-threading in Gtk2Hs has not changed. It is 
> still necessary to call
> all Gtk functions from a single Haskell  thread and to use the post* 
> functions in
> Graphics.UI.Gtk.General.General to emit a function call from a  different 
> thread. This is unlikely
> to change in the future since it is  impossible on Windows to call the Win32 
> API from more than one
> thread.  It is possible on Unix to call X11 from different threads (although 
> not at the same time),
> but it is probably pointless to allow this if  those programs cannot be run 
> on Windows afterwards.
>
> I agree that this warning is a bit harsh, or that 
> 'unsafeInitGUIForThreadedRTS' is a bit of a
> mouthful. It's quite  alright to use Gtk2Hs in a multithreaded program as 
> long as you call  all GUI
> functions from the same thread. You may call Glib, Cairo and  e.g. Pango 
> functions from a different
> thread (but you may not access  the same data structure concurrently from 
> different Haskell
> threads).  So you can implement your redraw handler in a different thread and 
>  post the result to
> the main thread that displays the result using Gtk  functions.
>
> We probably need some sort of user guide that explains all these issues.
I see, add documentation about this is good idea. :)

Recently, i'm test John's DBus Haskell implementation with gtk2hs, and works
well (support multi-thread).
I found use John's implementation is easier than Glib-DBus (more
Haskell style).
So i won't push Glib-DBus patch to repository even i
finish most binding, because some proxy functions (call method from
other process) can't support by current FFI.

And i'm try refactory my project to implementation
multi-thread/multi-process framework, maybe I will release it recently, then i
will add documentation and cool screenshot on gtk2hs website. :)

BTW, can we consider release next version of gtk2hs?
I have test darcs version with GHC-6.12.1, works well.

And we can add new API in changelog (such as vte, `DND tab in different
notebook`... etc), then user will try to use those new feature?

Please post "TASK LIST" here, i want help!

Cheers,

  -- Andy


>
> Thanks for raising this point,
> Axel.
>
>> Cheers,
>>
>>  -- Andy
>>
>>
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the business
>> Choose flexible plans and management services without long-term contracts
>> Personal 24x7 support from experience hosting pros just a phone call away.
>> http://p.sf.net/sfu/theplanet-com
>> _______________________________________________
>> Gtk2hs-devel mailing list
>> Gtk2hs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

Reply via email to