| 118 | | psem = sem_open(name.str().c_str(), |
| 119 | | /*O_CREAT |*/ O_EXCL, S_IRUSR | S_IWUSR | S_IXUSR, 0); |
| 120 | | if (reinterpret_cast<int>(psem) == -1) { |
| 121 | | halt << "sem_open() failed"; |
| 122 | | } |
| 123 | | |
| | 118 | psem = sem_open(name.str().c_str(), O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IXUSR, 0); |
| | 119 | if (psem != SEM_FAILED) { |
| | 120 | return; |
| | 121 | } |
| | 122 | if (errno == EEXIST) { |
| | 123 | debug << "semaphore [" << name.str() << "] is already exists."; |
| | 124 | psem = sem_open(name.str().c_str(), O_EXCL, S_IRUSR | S_IWUSR | S_IXUSR, 0); |
| | 125 | if (psem != SEM_FAILED) { |
| | 126 | return; |
| | 127 | } |
| | 128 | } |
| | 129 | halt << "sem_open() failed"; |