Hi James, I have moved that to osg-users. No longer in any way a submission related thing ...
On Wednesday 24 September 2008 00:15, James Killian wrote: > I have had an opportunity to work with a case where I need a many-to-one > relationship. So for example lets say there are several threads working in > tandem, and they simply make a function/method call, and at any given > timeslice a single thread will process all the calls that happened in its > own thread. There is a win32 way to handle this without the need of any > critical sections, mutex, semaphore, setevent, etc... This would be done > VIA passing function pointers (i.e. these could be cpp methods too) in the > APC queue. What then happens is during the context switch the OS processes > all method calls passed in (this can work with parameters too) and calls > the methods in the same single thread. This works best for cases where > there is work to be done from a single point. > > Ideally the client code would be easier to write, and with all atomic > operations make the synchronization more efficient than using other > synchronization techniques. The downside of course is trying to have some > generic form of this technique for other platforms, but there may be a > possibility of this happening. > > So this is the idea. The thing which I am not sure about is if this could > be useful when culling works together with opengl (or other similar > serialization processes). I also do not know if the gain would be > significant for these cases. One thing is for certain... the absence of > critical sections is good in that it decreases the chance for deadlocks. > > The client code would have a method to handle outside thread calls. This > method simply invokes some ThreadCall(bool > wait_for_return,thread,instance,func ptr, ... parms) and then the actual > method would auto-magically be called on the thread (whatever parameter > which was passed in as thread) timeslice interval . > > If this sounds like a cool technique to pursue then I could see what I can > do to provide more info. What you are talking about is some kind of queue that can be filled by many threads and emptied by a single thread at a specified time. So what you basically need to do is, have either a lockless queue implementation or a mutex that protects that queue. Note that even if you do not see that fact behind the win32 api, that must happen inside that APC queue anyway. So you have exactly the same serialization points than you have in any case ... For lockless queues/lists, google for RCU/list/queue to see how this can be done. It is relatively simple using atomic compare and swap operations. But anyway, I do still not see where you want that serialized events to be processed? And where this sould happen in osg and for what reason? I am sure I miss something important... May be you put that in your application library for your use??? Greetings Mathias -- Dr. Mathias Fröhlich, science + computing ag, Software Solutions Hagellocher Weg 71-75, D-72070 Tuebingen, Germany Phone: +49 7071 9457-268, Fax: +49 7071 9457-511 -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Florian Geyer, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Prof. Dr. Hanns Ruder Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org