-// struct ustcomm_ustd ustd;
-// int result;
-// sigset_t sigset;
-//
-// result = sigemptyset(&sigset);
-// if(result == -1) {
-// perror("sigemptyset");
-// return;
-// }
-// result = sigaddset(&sigset, SIGIO);
-// if(result == -1) {
-// perror("sigaddset");
-// return;
-// }
-// result = sigprocmask(SIG_BLOCK, &sigset, NULL);
-// if(result == -1) {
-// perror("sigprocmask");
-// return;
-// }
-//
-// if(trace_recording()) {
-// if(!have_consumer()) {
-// /* Request listener creation. We've blocked SIGIO's in
-// * order to not interrupt sleep(), so we will miss the
-// * one sent by the daemon and therefore won't create
-// * the listener automatically.
-// */
-// create_listener();
-//
- printf("Keeping process alive for consumer daemon...\n");
- restarting_sleep(3);
- printf("Finally dying...\n");
-// }
-// }
-//
-// result = sigprocmask(SIG_UNBLOCK, &sigset, NULL);
-// if(result == -1) {
-// perror("sigprocmask");
-// return;
-// }
+ if(trace_recording() && buffers_to_export) {
+ DBG("Keeping process alive for consumer daemon...");
+ while(buffers_to_export) {
+ const int interv = 200000;
+ int total = 0;
+ restarting_usleep(20000);
+ total += interv;
+
+ if(total >= 3000000) {
+ WARN("non-consumed buffers remaining after limit; not waiting anymore");
+ break;
+ }
+ }
+ DBG("Finally dying...");
+ }