| 1 | ////////////////////////////////////////////////////////////////////////////// |
|---|---|
| 2 | // |
| 3 | // (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost |
| 4 | // Software License, Version 1.0. (See accompanying file |
| 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | // |
| 7 | // See http://www.boost.org/libs/interprocess for documentation. |
| 8 | // |
| 9 | ////////////////////////////////////////////////////////////////////////////// |
| 10 | //[doc_anonymous_semaphore_shared_data |
| 11 | #include <boost/interprocess/sync/interprocess_semaphore.hpp> |
| 12 | |
| 13 | struct shared_memory_buffer |
| 14 | { |
| 15 | enum { NumItems = 10 }; |
| 16 | |
| 17 | shared_memory_buffer() |
| 18 | : mutex(1), nempty(NumItems), nstored(0) |
| 19 | {} |
| 20 | |
| 21 | //Semaphores to protect and synchronize access |
| 22 | boost::interprocess::interprocess_semaphore |
| 23 | mutex, nempty, nstored; |
| 24 | |
| 25 | //Items to fill |
| 26 | int items[NumItems]; |
| 27 | }; |
| 28 | //] |
| 29 |
