From: Matthias R. <mat...@go...> - 2010-05-24 02:16:11
|
Hi Axel and Hamish, Am 23.05.2010 20:03 schrieb Axel Simon: > Hi Hamish, > > On May 23, 2010, at 19:29, Hamish Mackenzie wrote: > >> On 24 May 2010, at 03:53, Axel Simon wrote: >>> I think I understood and fixed the problem. >> I have was able to reproduce the problem on XP and your fix has >> cleared it. >> >> I guess the thread restrictions must have been relaxed int Windows 7. >> >>> Hamish, I removed your Windows specific modifications to hsgthread.c >>> because the glib version works just fine. Also, I think there was a >>> race condition in that you check if the mutex has been initialized >>> before you take it. Several threads could do find that the mutex >>> hasn't been initialised which would lead to multiple initializations. >> Yes there is a potential race condition there. I know how to fix >> this in C++ (singleton pattern), would using C++ be ok? Is there a >> way to do the same in C? >> >>> So I hope this is all acceptable and works in all conditions. >>> >>> I would greatly appreciate it if you could pull my two patches and >>> see >>> if it all works for you! >> Without the windows CriticalSection version I still get. >> $ ghci -package gtk >> : C:\SDKs\Haskell\gtk-0.10.5\ghc-6.12.1\HSgtk-0.10.5.o: unknown >> symbol `__imp__g_threads_got_initialized' >> > Oh, weird. Ok. > > Can you revert my changes in the last patch then? > > Can't the race condition be fixed by initializing the mutex in the > hsg_thread_initialise function? That's easiest. > > Cheers, > Axel first of all, thanks a lot you help! I've gotten the same error as Hamish, so I skipped the second patch (`Remove Windows specific mutex operations') and everything works fine now, at least with GHC 6.12.1 and Gtk 2.20. I will try GHC 6.10.4 and Gtk 2.18 later today. Thanks again, Matthias |