diff options
author | Aaron Bannert <aaron@apache.org> | 2002-01-22 23:56:23 +0000 |
---|---|---|
committer | Aaron Bannert <aaron@apache.org> | 2002-01-22 23:56:23 +0000 |
commit | 62736066cd341b3fffd29543917af0d385ddf745 (patch) | |
tree | 6f4815f7d03ab3b9e8a45e7444e027bdd466c0e2 /test/testshmproducer.c | |
parent | 6d3db86d98c3c97876b3661abd644b899543277a (diff) | |
download | apr-62736066cd341b3fffd29543917af0d385ddf745.tar.gz |
Delete the apr_shm_t when we're done with it. (This didn't work before,
but I'm about to commit the implementation.)
Add more verbose status/error messages -- most importantly making it
obvious from which child (consumer or producer) the messages are comming
from.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62815 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testshmproducer.c')
-rw-r--r-- | test/testshmproducer.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/test/testshmproducer.c b/test/testshmproducer.c index afb4f26ab..162eca19c 100644 --- a/test/testshmproducer.c +++ b/test/testshmproducer.c @@ -79,7 +79,7 @@ mbox *boxes; static void msgput(int boxnum, char *msg) { - fprintf(stdout, "Sending message to box %d\n", boxnum); + fprintf(stdout, "Producer: Sending message to box %d\n", boxnum); apr_cpystrn(boxes[boxnum].msg, msg, strlen(msg)); boxes[boxnum].msgavail = 1; } @@ -103,12 +103,15 @@ int main(void) } printf("OK\n"); + printf("Producer attaching to name-based shared memory...."); rv = apr_shm_attach(&shm, SHARED_FILENAME, pool); if (rv != APR_SUCCESS) { - printf("Unable to attach to name-based shared memory segment: " - "[%d] %s \n", rv, apr_strerror(rv, errmsg, sizeof(errmsg))); + printf("Producer unable to attach to name-based shared memory " + "segment: [%d] %s \n", rv, + apr_strerror(rv, errmsg, sizeof(errmsg))); exit(-2); } + printf("OK\n"); boxes = apr_shm_baseaddr_get(shm); @@ -118,12 +121,15 @@ int main(void) apr_sleep(1*APR_USEC_PER_SEC); } + printf("Producer detaching from name-based shared memory...."); rv = apr_shm_detach(shm); if (rv != APR_SUCCESS) { - printf("Unable to detach from name-based shared memory segment: " - "[%d] %s \n", rv, apr_strerror(rv, errmsg, sizeof(errmsg))); + printf("Producer unable to detach from name-based shared memory " + "segment: [%d] %s \n", rv, + apr_strerror(rv, errmsg, sizeof(errmsg))); exit(-3); } + printf("OK\n"); return 0; } |