| 954 | } |
| 955 | |
| 956 | void ProfilerIpc::initClient() |
| 957 | { |
| 958 | // Shared memory mutex must be locked by caller |
| 959 | |
| 960 | fb_assert(isServer == false); |
| 961 | |
| 962 | const auto header = sharedMemory->getHeader(); |
| 963 | |
| 964 | // Here should not be event created by another alive client |
| 965 | |
| 966 | if (header->clientEvent.event_pid) |
| 967 | { |
| 968 | fb_assert(header->clientEvent.event_pid != getpid()); |
| 969 | |
| 970 | if (header->clientEvent.event_pid != getpid()) |
| 971 | { |
| 972 | if (ISC_check_process_existence(header->clientEvent.event_pid)) |
| 973 | (Arg::Gds(isc_random) << "ProfilerIpc eventInit(clientEvent) failed").raise(); |
| 974 | } |
| 975 | |
| 976 | sharedMemory->eventFini(&header->clientEvent); |
| 977 | } |
| 978 | |
| 979 | if (sharedMemory->eventInit(&header->clientEvent) != FB_SUCCESS) |
| 980 | (Arg::Gds(isc_random) << "ProfilerIpc eventInit(clientEvent) failed").raise(); |
| 981 | } |
| 982 | |
| 983 | |
| 984 | //-------------------------------------- |