Merge branch 'development' into LTS_development
This commit is contained in:
commit
6bca77d758
3 changed files with 8 additions and 0 deletions
|
@ -2081,7 +2081,9 @@ namespace DTSC {
|
||||||
bool Meta::toFile(const std::string & fileName){
|
bool Meta::toFile(const std::string & fileName){
|
||||||
std::ofstream oFile(fileName.c_str());
|
std::ofstream oFile(fileName.c_str());
|
||||||
oFile << toJSON().toNetPacked();
|
oFile << toJSON().toNetPacked();
|
||||||
|
if (!oFile.good()){return false;}
|
||||||
oFile.close();
|
oFile.close();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///\brief Converts a meta object to a human readable string
|
///\brief Converts a meta object to a human readable string
|
||||||
|
|
|
@ -223,6 +223,7 @@ namespace IPC {
|
||||||
|
|
||||||
///\brief Tries to wait for the semaphore, returns true if successful, false otherwise
|
///\brief Tries to wait for the semaphore, returns true if successful, false otherwise
|
||||||
bool semaphore::tryWait() {
|
bool semaphore::tryWait() {
|
||||||
|
if (!(*this)){return false;}
|
||||||
int result;
|
int result;
|
||||||
#if defined(__CYGWIN__) || defined(_WIN32)
|
#if defined(__CYGWIN__) || defined(_WIN32)
|
||||||
result = WaitForSingleObject(mySem, 0);//wait at most 1ms
|
result = WaitForSingleObject(mySem, 0);//wait at most 1ms
|
||||||
|
@ -238,6 +239,7 @@ namespace IPC {
|
||||||
|
|
||||||
///\brief Tries to wait for the semaphore for a single second, returns true if successful, false otherwise
|
///\brief Tries to wait for the semaphore for a single second, returns true if successful, false otherwise
|
||||||
bool semaphore::tryWaitOneSecond() {
|
bool semaphore::tryWaitOneSecond() {
|
||||||
|
if (!(*this)){return false;}
|
||||||
int result;
|
int result;
|
||||||
#if defined(__CYGWIN__) || defined(_WIN32)
|
#if defined(__CYGWIN__) || defined(_WIN32)
|
||||||
result = WaitForSingleObject(mySem, 1000);//wait at most 1s
|
result = WaitForSingleObject(mySem, 1000);//wait at most 1s
|
||||||
|
|
|
@ -341,6 +341,10 @@ namespace Mist {
|
||||||
void Input::stream(){
|
void Input::stream(){
|
||||||
IPC::semaphore pullLock;
|
IPC::semaphore pullLock;
|
||||||
pullLock.open(std::string("/MstPull_" + streamName).c_str(), O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
pullLock.open(std::string("/MstPull_" + streamName).c_str(), O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||||
|
if (!pullLock){
|
||||||
|
FAIL_MSG("Could not open pull lock for stream '%s' - aborting!", streamName.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!pullLock.tryWait()){
|
if (!pullLock.tryWait()){
|
||||||
WARN_MSG("A pull process for stream %s is already running", streamName.c_str());
|
WARN_MSG("A pull process for stream %s is already running", streamName.c_str());
|
||||||
pullLock.close();
|
pullLock.close();
|
||||||
|
|
Loading…
Add table
Reference in a new issue