Merge branch 'development' into LTS_development
This commit is contained in:
commit
b2bcef16c9
3 changed files with 11 additions and 3 deletions
|
@ -46,9 +46,9 @@ static const char * DBG_LVL_LIST[] = {"NONE", "FAIL", "ERROR", "WARN", "INFO", "
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#if DEBUG >= DLVL_DEVEL
|
#if DEBUG >= DLVL_DEVEL
|
||||||
#define DEBUG_MSG(lvl, msg, ...) if (Util::Config::printDebugLevel >= lvl){fprintf(stderr, "%s||%d|%s:%d|%s|" msg "\n", DBG_LVL_LIST[lvl], getpid(), __FILE__, __LINE__, Util::Config::streamName.c_str(), ##__VA_ARGS__);}
|
#define DEBUG_MSG(lvl, msg, ...) if (Util::Config::printDebugLevel >= lvl){fprintf(stderr, "%s|MistProcess|%d|%s:%d|%s|" msg "\n", DBG_LVL_LIST[lvl], getpid(), __FILE__, __LINE__, Util::Config::streamName.c_str(), ##__VA_ARGS__);}
|
||||||
#else
|
#else
|
||||||
#define DEBUG_MSG(lvl, msg, ...) if (Util::Config::printDebugLevel >= lvl){fprintf(stderr, "%s||%d||%s|" msg "\n", DBG_LVL_LIST[lvl], getpid(), Util::Config::streamName.c_str(), ##__VA_ARGS__);}
|
#define DEBUG_MSG(lvl, msg, ...) if (Util::Config::printDebugLevel >= lvl){fprintf(stderr, "%s|MistProcess|%d||%s|" msg "\n", DBG_LVL_LIST[lvl], getpid(), Util::Config::streamName.c_str(), ##__VA_ARGS__);}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,14 @@ namespace IPC {
|
||||||
#else
|
#else
|
||||||
if (oflag & O_CREAT) {
|
if (oflag & O_CREAT) {
|
||||||
mySem = sem_open(name, oflag, mode, value);
|
mySem = sem_open(name, oflag, mode, value);
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
if (!(*this)){
|
||||||
|
if (sem_unlink(name) == 0){
|
||||||
|
INFO_MSG("Deleted in-use semaphore: %s", name);
|
||||||
|
mySem = sem_open(name, oflag, mode, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
mySem = sem_open(name, oflag);
|
mySem = sem_open(name, oflag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ DTSC::Meta Util::getStreamMeta(const std::string &streamname){
|
||||||
bool Util::streamAlive(std::string &streamname){
|
bool Util::streamAlive(std::string &streamname){
|
||||||
char semName[NAME_BUFFER_SIZE];
|
char semName[NAME_BUFFER_SIZE];
|
||||||
snprintf(semName, NAME_BUFFER_SIZE, SEM_INPUT, streamname.c_str());
|
snprintf(semName, NAME_BUFFER_SIZE, SEM_INPUT, streamname.c_str());
|
||||||
IPC::semaphore playerLock(semName, O_RDWR, ACCESSPERMS, 1, true);
|
IPC::semaphore playerLock(semName, O_RDWR, ACCESSPERMS, 0, true);
|
||||||
if (!playerLock){return false;}
|
if (!playerLock){return false;}
|
||||||
if (!playerLock.tryWait()){
|
if (!playerLock.tryWait()){
|
||||||
playerLock.close();
|
playerLock.close();
|
||||||
|
|
Loading…
Add table
Reference in a new issue