| 818 | |
| 819 | |
| 820 | int SharedMemoryBase::eventPost(event_t* event) |
| 821 | { |
| 822 | /************************************** |
| 823 | * |
| 824 | * I S C _ e v e n t _ p o s t |
| 825 | * |
| 826 | ************************************** |
| 827 | * |
| 828 | * Functional description |
| 829 | * Post an event to wake somebody else up. |
| 830 | * |
| 831 | **************************************/ |
| 832 | |
| 833 | #if defined(WIN_NT) |
| 834 | |
| 835 | ++event->event_count; |
| 836 | |
| 837 | if (event->event_pid != process_id) |
| 838 | return ISC_kill(event->event_pid, event->event_id, event->event_handle) == 0 ? FB_SUCCESS : FB_FAILURE; |
| 839 | |
| 840 | return SetEvent(event->event_handle) ? FB_SUCCESS : FB_FAILURE; |
| 841 | |
| 842 | #else // pthread-based event |
| 843 | |
| 844 | PTHREAD_ERROR(pthread_mutex_lock(event->event_mutex)); |
| 845 | ++event->event_count; |
| 846 | const int ret = pthread_cond_broadcast(event->event_cond); |
| 847 | PTHREAD_ERROR(pthread_mutex_unlock(event->event_mutex)); |
| 848 | if (ret) |
| 849 | { |
| 850 | gds__log ("ISC_event_post: pthread_cond_broadcast failed with errno = %d", ret); |
| 851 | return FB_FAILURE; |
| 852 | } |
| 853 | |
| 854 | return FB_SUCCESS; |
| 855 | |
| 856 | #endif // OS-dependent choice |
| 857 | |
| 858 | } // anonymous namespace |
| 859 | |
| 860 | |
| 861 | #ifdef UNIX |
no test coverage detected