| 2531 | |
| 2532 | |
| 2533 | void Service::finish(USHORT flag) |
| 2534 | { |
| 2535 | if (flag == SVC_finished || flag == SVC_detached) |
| 2536 | { |
| 2537 | ExistenceGuard guard(this, FB_FUNCTION); |
| 2538 | |
| 2539 | svc_flags |= flag; |
| 2540 | if ((svc_flags & SVC_finished) && (svc_flags & SVC_detached)) |
| 2541 | { |
| 2542 | delete this; |
| 2543 | return; |
| 2544 | } |
| 2545 | |
| 2546 | if (svc_flags & SVC_detached) |
| 2547 | { |
| 2548 | svc_sem_empty.release(); |
| 2549 | |
| 2550 | // if service waits for data from us - return EOF |
| 2551 | { // guard scope |
| 2552 | MutexLockGuard guard(svc_stdin_mutex, FB_FUNCTION); |
| 2553 | |
| 2554 | if (svc_stdin_size_requested) |
| 2555 | { |
| 2556 | svc_stdin_user_size = 0; |
| 2557 | svc_stdin_semaphore.release(); |
| 2558 | } |
| 2559 | } |
| 2560 | } |
| 2561 | |
| 2562 | if (svc_flags & SVC_finished) |
| 2563 | { |
| 2564 | unblockQueryGet(); |
| 2565 | } |
| 2566 | else |
| 2567 | { |
| 2568 | svc_detach_sem.release(); |
| 2569 | } |
| 2570 | } |
| 2571 | } |
| 2572 | |
| 2573 | |
| 2574 | void Service::conv_switches(ClumpletReader& spb, string& switches) |
no test coverage detected