Add mapper-wait-until-removed
This option will do the opposite of mapper wait
by blocking if a dbus object exists until that
object is removed.
Change-Id: Ia460b1ffdb912ba475b15ae5f8499a177e801dfd
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/libmapper/app.c b/libmapper/app.c
index 7efc08c..aa42461 100644
--- a/libmapper/app.c
+++ b/libmapper/app.c
@@ -119,7 +119,10 @@
goto finish;
}
- r = mapper_wait_async(conn, loop, argv+2, quit, loop, &wait);
+ if (!strcmp(argv[1], "wait"))
+ r = mapper_wait_async(conn, loop, argv+2, quit, loop, &wait, true);
+ else if (!strcmp(argv[1], "wait-until-removed"))
+ r = mapper_wait_async(conn, loop, argv+2, quit, loop, &wait, false);
if(r < 0) {
fprintf(stderr, "Error configuring waitlist: %s\n",
strerror(-r));
@@ -178,6 +181,8 @@
"\nCOMMANDS:\n"
" call invoke the specified method\n"
" wait wait for the specified objects to appear on the DBus\n"
+ " wait-until-removed"
+ " wait until the specified objects are not present in the DBus\n"
" get-service return the service identifier for input path\n";
if(argc < 2) {
@@ -187,7 +192,8 @@
if(!strcmp(argv[1], "call"))
call_main(argc, argv);
- if(!strcmp(argv[1], "wait"))
+ if(!strcmp(argv[1], "wait") ||
+ !strcmp(argv[1], "wait-until-removed"))
wait_main(argc, argv);
if(!strcmp(argv[1], "get-service"))
get_service_main(argc, argv);