tag:blogger.com,1999:blog-9007601562606157016.post6001156335674165487..comments2023-05-11T16:21:37.725+01:00Comments on <Stuff about="code" />: Shared Memory C & Python IPCMartin O'Hanlonhttp://www.blogger.com/profile/03047799173301971515noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-9007601562606157016.post-15706990035167669632014-03-04T15:56:49.215+00:002014-03-04T15:56:49.215+00:00whoops:
Need to change the Key up above to 123456...whoops:<br /><br />Need to change the Key up above to 123456 (not 12345678) to make it work with your C example.<br /><br />my $shm = IPC::SharedMem->new(123456, 11, S_IRUSR);<br /><br />-ChrisTrukkhttps://www.blogger.com/profile/05133977742999412260noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-53598346169004715542014-03-04T15:53:48.923+00:002014-03-04T15:53:48.923+00:00Great little write up, and *very* helpful. I'...Great little write up, and *very* helpful. I've never used Shared Mem or semaphores. Learn something new and useful everyday.<br /><br />A couple of quick notes:<br /><br />1) Looks like there is a cast issue in the line: shmdt(shmid); Not a C guy, but I changed it to shmdt(&shmid); and it compiled fine.<br /><br />2) I am also not a Python guy. I cut my teeth on Perl, so I played around a bit and got the reader working under Perl.<br /><br /><br />#!/usr/bin/perl -w<br />use strict;<br /><br />use IPC::SysV qw(IPC_PRIVATE S_IRUSR S_IWUSR);<br />use IPC::SharedMem;<br /><br />my $shm = IPC::SharedMem->new(12345678, 11, S_IRUSR);<br />my $val = $shm->read(0, 11);<br /><br />print "$val\n";<br /><br /><br /><br />Looking forward to going home tonight, and trying to figure out how to get the Perl semaphore code to work with Shared mem, so I can try and emulate what you did with your python example over on the Data Synching post: http://www.stuffaboutcode.com/2013/09/raspberry-pi-syncing-data-with-raspivid.html<br /><br />Already pulled and complied your userland fork for RASPIVID.<br /><br />GREAT INFO!<br /><br />-ChrisTrukkhttps://www.blogger.com/profile/05133977742999412260noreply@blogger.com