From: Miguel A. B. L. <sa...@re...> - 2000-09-26 19:19:17
|
> > I read this is SDL ML. One man had spent all a day trying to do a Increment > > function with Mutex and it didn't run. > > Understanding problem: Increment function == recursive function ? Or a function > that (atomically) increments some variable ? > Is there a good signal/noise-ratio on the SDL ML ? Yes, from time to time there is a noise post, but most of the time are problems you find while developing in SDL. > > SDL-1.1.5 come with Semaphores that are the correct instrument to use. > > I don´t see much use for a mutex at all, semaphores are much mor useful, > althoug possibly slower. Do we have so many concurrent accesses that the faster > mutices make a difference ? Else we could also provide a Semaphore-class, which > won´t bug us with those problems. > btw: If no native semaphore-class is available, SDL does it with a mutex, an > owner-ID, a lock-count etc... I will try to do it Threadless at all in a begin, to see if the problem "really" comes from there. But we should use Semaphore. > > The problem is that Mutex only locks ( and make the caller to wait ) if it is the > > same thread that create the Mutex. > > You mean, if thread A created the mutex and thread B tries to lock it, something > terrible happens? And B tries to lock and A has locked it before, the B simply continue, it should stop there, but it continues. Do you see the problem?. If we are managing pointers on the list in thread A and B enter to the list too, it break the whole list. > If so, on which system? I wrote my threadtest-example also to test mutices: If > you remove all the TempLocks on the static m_mutex, the output of the different > threads often appears atop of each other. > > > It is a pain to debug a multithread app. > Sometimes I understand why MSVC++6 Enterprise Edition costs 3500DM ... "Didn't it come in a CD with Windows 98 and cost 10$ ?", Just joking. Anyway whatever you use to debug Thread it is imposible to do, the better you can do is a formal demostration of the correctness of the program, that is also a pain. -- Miguel Angel Blanch Lardin -- http://www.arianne.cx -- Arianne -- The free open source massively multiplayer online role playing game nuclear cia fbi spy password code encrypt president bomb iran irak korea cuba Echelon must die |