| 8555 | |
| 8556 | |
| 8557 | static THREAD_ENTRY_DECLARE event_thread(THREAD_ENTRY_PARAM arg) |
| 8558 | { |
| 8559 | /************************************** |
| 8560 | * |
| 8561 | * e v e n t _ t h r e a d |
| 8562 | * |
| 8563 | ************************************** |
| 8564 | * |
| 8565 | * Functional description |
| 8566 | * Wait on auxilary mailbox for event notification. |
| 8567 | * |
| 8568 | **************************************/ |
| 8569 | rem_port* port = (rem_port*)arg; |
| 8570 | // Reference portRef(*port); |
| 8571 | PACKET packet; |
| 8572 | |
| 8573 | while (!(port->port_flags & PORT_disconnect)) |
| 8574 | { |
| 8575 | // zero packet |
| 8576 | |
| 8577 | zap_packet(&packet); |
| 8578 | |
| 8579 | // read what should be an event message |
| 8580 | |
| 8581 | rem_port* stuff = NULL; |
| 8582 | P_OP operation = op_void; |
| 8583 | { // scope |
| 8584 | RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION); |
| 8585 | try |
| 8586 | { |
| 8587 | stuff = port->receive(&packet); |
| 8588 | } |
| 8589 | catch(status_exception&) |
| 8590 | { |
| 8591 | // ignore |
| 8592 | } |
| 8593 | |
| 8594 | operation = packet.p_operation; |
| 8595 | |
| 8596 | if (!stuff || operation == op_exit || operation == op_disconnect) |
| 8597 | { |
| 8598 | // Actually, the remote server doing the watching died. |
| 8599 | // Clean up and leave. |
| 8600 | |
| 8601 | REMOTE_free_packet(port, &packet); |
| 8602 | server_death(port); |
| 8603 | break; |
| 8604 | } |
| 8605 | } // end scope |
| 8606 | |
| 8607 | // If the packet was an event, we handle it |
| 8608 | |
| 8609 | if (operation == op_event) |
| 8610 | { |
| 8611 | P_EVENT* pevent = &packet.p_event; |
| 8612 | |
| 8613 | Rvnt* event = NULL; |
| 8614 | { // scope |
nothing calls this directly
no test coverage detected