Re: bus error when use threads and native mode on Mac
Jacques Garrigue <[email protected]> Fri, 17 Sep 2010 20:01:34 +0900
| Newsgroups | gmane.comp.lang.ocaml.lib.gtk |
|---|---|
| Message-ID | <[email protected]> |
On 2010/09/17, at 18:27, Olivier Andrieu wrote: > Hi, > > On Fri, Sep 17, 2010 at 11:02, Yoann Padioleau <[email protected]> wrote: >> Hi, >> >> I am trying to use threads in my lablgtk application but it crashes (I am on Mac OS) >> in native mode with a mysterious "Bus Error". >> I have linked my program with -thread and use >> GtkThread.main (); >> in the main but it does not work. It works nice in bytecode mode though. >> >> My program displays some fancy graphics with cairo and then run in the background using a thread >> some heavy computation that I access on demand from the main thread when the user click >> on certain things. >> >> My code also uses GMain.Idle and Gmain.Timeout (don't know if it's relevant). > > It might ! Timeout and idle callbacks have different rules than the > usual widget event callbacks wrt. threading. > cf. http://library.gnome.org/devel/gdk/stable/gdk-Threads.html#gdk-Threads.description > > « Idles, timeouts, and input functions from GLib, such as > g_idle_add(), are executed outside of the main GTK+ lock. » Actually, this shouldn't be relevant, as LablGTK does not use GTK+ thread locking. It only uses the giant ocaml lock. But we may need more information on your program. Are you using Gtk+ on X11 or Quartz (the latter is much more picky with threads)? What are all the versions (did you try with 2.14.2?) The difference between bytecode and native is intriguing. This maybe an ocaml problem, or just a problem triggerred by a difference in scheduling. Jacques