Skip to main content
10 events
when toggle format what by license comment
Apr 17, 2016 at 15:59 comment added Jules @Frank - Sutter's comments are really quite specific to working on shared memory in a C++ environment. Under C#, you would find it extremely difficult to place a pointer into shared memory simply because you don't tend (unless working with unsafe extensions) to ever have access to raw pointers in that language. I'd suggest forgetting about pthreads, which really has nothing to do with your problem, and using one of the other mutex implementations already mentioned, or the alternative I'm about to suggest in an answer...
Apr 17, 2016 at 10:57 comment added Basile Starynkevitch You can email me (my email is really easy to find), but I know nothing about Boost...
Apr 17, 2016 at 8:35 comment added Frank @Basile Starynkevitch, I appreciate your sense of honor in answering my questions over the past 4 days. I just added an excerpt from Herb Sutter's Boost documentation about the limitations of sharing memory between processes to the tail end of the original question. It says that "raw pointers are a problem since they are only valid for the process that placed them there". ratchet_freak said that since pthread_mutex_t contained a raw pointer member it would have problems with interprocess synchronization. Could I email you about how to use Boost.Interprocess special smart pointer?
Apr 17, 2016 at 6:43 comment added Basile Starynkevitch A pthread_mutex_t is for locking inside threads of the same process. Use sem_overview(7) for inter-process synchronization. So don't share any pthread_mutex_t between different processes.
Apr 15, 2016 at 14:14 comment added Frank I have a question about Figure 11.10, Using a mutex to protect a data structure on page 372 of "Advanced Programming in the UNIX Environment Second Edition" by W. Richard Stevens and Stephen A. Rago. Figure 11.10 uses malloc(sizeof(struct foo)) to allocate the reference counted object. May one use this example to share a mutex between processes?
Apr 15, 2016 at 14:00 comment added ratchet freak @Frank when you do "sem_open" the OS will look for other semaphores with the same name and return a handle to an existing semaphore if there is already one (creating one otherwise if the flag was set). Waiting and signaling semaphores are system calls and the kernel will deal with the exclusive access.
Apr 15, 2016 at 13:43 comment added Frank How is a Linux explicit named semaphore shared across processes? I realize a named semaphore is different than a pthreads mutex. Thank you.
Apr 15, 2016 at 13:19 comment added Frank I just read your excellent answer. I ran the Linux command , ps -ef , and it showed different process ids for the video server and the recorder.
Apr 15, 2016 at 12:58 vote accept Frank
Apr 19, 2016 at 19:57
Apr 15, 2016 at 12:07 history answered ratchet freak CC BY-SA 3.0