[shmem] Uploaded to Vault+documentation questions+misc

Hi James and all shmem users, Sorry for uploading to boost files but I had some problems with file size, so I uploaded to boost files instead. In boost vault you will fine a new folder (Shmem) with 3 new files: Shmem.2005-03-06.tar.bz2 //library Shmem.2005-03-06-doc-1.tar.bz2 //doc1 Shmem.2005-03-06-doc-2.tar.bz2 //doc2 Write now I am writing documentation with a text editor and it's just a pain. For this version, I've discovered the CDATA usage so I don't have to manually escape XML characters (<, >, &). I will have a look at Quickbook. Is there any way to "insert" a cpp file directly on the code using BoostBook/QuickBook? That would help me a lot to mantain example code without errors. I've also seen in unordered associative containers documentation that colored code is used and I'm very interested in that, but I don't know if that is provided by BoostBook or was created with an external tool. Regarding new version, there are some name changes, so please, forgive me. I don't plan any further name changes except after a boost review. I've tested it in Windows XP using visual 7.1 mainly and Linux 2.6 kernel (Suse 9.2) using gcc 3.4.1. But it's possible to be errors in some linux tests. For this version I don't have any atomic swap/inc/test function and I don't plan to have it, because library has grown so much that I prefer to polish a bit this. I agree that those functions would be very useful to implement lock-free allocators and structures. If win32 shared_mutex/shared_condition seem very rudimentary test/yield functions but I've not found any pthread-like process shared mutex/condition implementation in any place (the latest time I checked, cygwin, pthread-win32, Windows Unix Services, didn't support that) so I had to make this hack to go on. When I propose a review process, surely synchronization objects should be included/adapted to boost threads, but currently boost::thread's elements don't allow single threaded builds, so I can't use boost::xtime and scoped_locks in shmem when synchronizing two single threaded processes. That's why I've copied those classes in my library changing their name. One last thing: shared memory creation/destruction is not very portable, because I can't find a common implementation that suits win32/posix shared memory model (I mean shm_unlink behaviour). I've not found any valid implementation except using System V shared memory to emulate Win32 shared memory, but I want to use posix functions if available. Has anyone solved this before? Well, thank you for your comments and feel free to write if any problem is found. Regards, Ion

Is it possible to use the shmem allocator and offset_ptr without sharing memory? I was thinking about using it to send complex structures in a message between processes. In my case the buffer could be static but in general I assume it could use new and maybe even be allowed to change size.

Hello Martin, offset_ptr can be used in stack/heap if you want, You can use basic allocation algorithms in any memory. I don't know if any component is too tied with shared memory to use it in a message buffer. Please, write me explaining your case with a bigger picture and what do you really want from the framework (I mean STL allocators? Just buffer management algorithms?, etc... ). I will be glad to explain if you can use it and if it is useful and it is not possible right now, I could add it to the library. Regards, Ion ----- Original Message ----- From: "Martin" <adrianm@touchdown.se> To: <boost@lists.boost.org> Sent: Wednesday, March 09, 2005 1:11 PM Subject: [boost] Re: [shmem] Uploaded to Vault+documentation questions+misc
Is it possible to use the shmem allocator and offset_ptr without sharing memory?
I was thinking about using it to send complex structures in a message between processes. In my case the buffer could be static but in general I assume it could use new and maybe even be allowed to change size.

"ION_G_M" <ION_G_M@terra.es> wrote in message news:aea91b051a.b051aaea91@teleline.es...
Hi James and all shmem users,
Sorry for uploading to boost files but I had some problems with file size, so I uploaded to boost files instead. In boost vault you will fine a new folder (Shmem) with 3 new files:
Shmem.2005-03-06.tar.bz2 //library Shmem.2005-03-06-doc-1.tar.bz2 //doc1 Shmem.2005-03-06-doc-2.tar.bz2 //doc2
Write now I am writing documentation with a text editor and it's just a pain. For this version, I've discovered the CDATA usage so I don't have to manually escape XML characters (<, >, &). I will have a look at Quickbook. Is there any way to "insert" a cpp file directly on the code using BoostBook/QuickBook? That would help me a lot to mantain example code without errors.
I've found Doxygen a nice tool for writing code documentation. Its easy to use, and allows you to #include fragments of source code from an external source, which is a nice feature for code documentation. It also understands and parses the C++ code, so that you can maintain links between classes and structures. Look at doxygen.org if you're interested. Rob.

Thanks I will look at it, Curently Shmem reference is built using doxygen but this is just done following and copying other xml files from other libraries. Doxygen help is just appended as reference. I was looking something to include that directly from the xml file. Is it possible to use Doxygen #include commands in BoostBook? Another thing, can I get syntax highlighted code in BoostBook? I've seen that in some Hash documentation. Thank you for all, I will look at doxygen a bit, Ion But I was ----- Original Message ----- From: "Robert Mathews" <rmathews@envoyww.com> To: <boost@lists.boost.org> Sent: Wednesday, March 09, 2005 4:36 PM Subject: [boost] Re: [shmem] Uploaded to Vault+documentation questions+misc
"ION_G_M" <ION_G_M@terra.es> wrote in message news:aea91b051a.b051aaea91@teleline.es...
Hi James and all shmem users,
Sorry for uploading to boost files but I had some problems with file size, so I uploaded to boost files instead. In boost vault you will fine a new folder (Shmem) with 3 new files:
Shmem.2005-03-06.tar.bz2 //library Shmem.2005-03-06-doc-1.tar.bz2 //doc1 Shmem.2005-03-06-doc-2.tar.bz2 //doc2
Write now I am writing documentation with a text editor and it's just a pain. For this version, I've discovered the CDATA usage so I don't have to manually escape XML characters (<, >, &). I will have a look at Quickbook. Is there any way to "insert" a cpp file directly on the code using BoostBook/QuickBook? That would help me a lot to mantain example code without errors.
I've found Doxygen a nice tool for writing code documentation. Its easy to use, and allows you to #include fragments of source code from an external source, which is a nice feature for code documentation. It also understands and parses the C++ code, so that you can maintain links between classes and structures.
Look at doxygen.org if you're interested.
Rob.

ION_G_M wrote:
... In boost vault you will fine a new folder (Shmem) with 3 new files:
thanks!
Write now I am writing documentation with a text editor and it's just a pain. For this version, I've discovered the CDATA usage so I don't have to manually escape XML characters (<, >, &). I will have a look at Quickbook.
QuickBook takes care of all that. Ironically, the only time this has been a problem for me is this morning when I _didn't_ want to escape things for me, because I was adding "Ion Gaztañaga" to certain parts of my docs :) There's a way to 'escape' QuickBook's normal processing and insert raw XML, but it's a little awkward for just one small piece of a phrase.
Is there any way to "insert" a cpp file directly on the code using BoostBook/QuickBook? That would help me a lot to mantain example code without errors.
There is an experimental version floating around which supports this. I recently added support for "include" semantics, and Thomas Guest has done some cool stuff with dynamic filtering to make source code look really spiff (color highlighting based on C++ syntax). Using this in a quickbook document be as simple as [section:qg_memory_pool I want to use shared memory as a memory pool] You are the biggest fan of malloc/free and you hate passing long messages to other processes ... You just need to type in one process: [include ../example/creat_pool.cpp] In receiver process one just could write the following lines: [include ../example/use_pool.cpp] [endsect] I've attached a larger sample based on your "Quick Guide" (which might be out of date...). Take a look, and if your interested check out the Boost Documentation list at https://lists.sourceforge.net/lists/listinfo/boost-docs. There's quite a bit happening with QuickBook.
I've also seen in unordered associative containers documentation that colored code is used and I'm very interested in that, but I don't know if that is provided by BoostBook or was created with an external tool.
QuickBook handles that automatically. With the new dynamic highlighting, you can even extend it to support totally custom source-code formats (C++, Python, and QuickBook support is built in). - james -- __________________________________________________________ James Fowler, Open Sea Consulting http://www.OpenSeaConsulting.com, Marietta, Georgia, USA Do C++ Right. http://www.OpenCpp.org, opening soon! [section:quick_guide Quick Guide for the Impatient] You don not want to read all this boring documentation. You just want to do some fast programming. So this is the section for you: [section:qg_memory_pool I want to use shared memory as a memory pool] You are the biggest fan of malloc/free and you hate passing long messages to other processes (fragment message, send, and rebuild message). You just want to copy your long message to memory, you don not want to remember if that shared memory portion was used or not, send memory offset to another process, and continue doing that with other processes. You just need to type in one process: [include ../example/creat_pool.cpp] In receiver process one just could write the following lines: [include ../example/use_pool.cpp] [endsect] [section:qg_named_shmem I want to create named shared memory objects] You want to create a shared memory objects, giving a name to them so that any other process can look for that object, use it and delete it from segment when the object is not needed anymore. Just write this code in one process: [include ../example/create_named.cpp] In other process, while the first process is alive, execute the following: [include ../example/use_named.cpp] [endsect] [section:qg_named_shmem_algo I want to create named shared memory objects with my own shared memory allocation algorithm] Creating a new memory allocator algorithm to use it in Boost Shmem framework is very easy. Read "Writing a new shared memory allocation algorithm" to write your own algorithm. After that, you only need to change a single line in the previous example: named_object_manager segment; becomes: basic_named_object_manager<char, MyAlgorithm> segment; [endsect] [endsect]
participants (5)
-
Ion Gaztañaga
-
ION_G_M
-
James Fowler
-
Martin
-
Robert Mathews