Fix DTSC::Meta::clear() using a semaphore to clear uninitialized state
This commit is contained in:
parent
027bd5f9da
commit
b0b5e2ebcc
1 changed files with 11 additions and 6 deletions
17
lib/dtsc.cpp
17
lib/dtsc.cpp
|
@ -2351,10 +2351,13 @@ namespace DTSC{
|
||||||
tMemBuf.clear();
|
tMemBuf.clear();
|
||||||
sizeMemBuf.clear();
|
sizeMemBuf.clear();
|
||||||
}else if (isMaster){
|
}else if (isMaster){
|
||||||
char pageName[NAME_BUFFER_SIZE];
|
IPC::semaphore trackLock;
|
||||||
snprintf(pageName, NAME_BUFFER_SIZE, SEM_TRACKLIST, streamName.c_str());
|
if (streamName.size()){
|
||||||
IPC::semaphore trackLock(pageName, O_CREAT|O_RDWR, ACCESSPERMS, 1);
|
char pageName[NAME_BUFFER_SIZE];
|
||||||
trackLock.tryWaitOneSecond();
|
snprintf(pageName, NAME_BUFFER_SIZE, SEM_TRACKLIST, streamName.c_str());
|
||||||
|
trackLock.open(pageName, O_CREAT|O_RDWR, ACCESSPERMS, 1);
|
||||||
|
trackLock.tryWaitOneSecond();
|
||||||
|
}
|
||||||
std::set<size_t> toRemove;
|
std::set<size_t> toRemove;
|
||||||
for (std::map<size_t, IPC::sharedPage>::iterator it = tM.begin(); it != tM.end(); it++){
|
for (std::map<size_t, IPC::sharedPage>::iterator it = tM.begin(); it != tM.end(); it++){
|
||||||
if (!it->second.mapped){continue;}
|
if (!it->second.mapped){continue;}
|
||||||
|
@ -2365,8 +2368,10 @@ namespace DTSC{
|
||||||
}
|
}
|
||||||
if (streamPage.mapped && stream.isReady()){stream.setExit();}
|
if (streamPage.mapped && stream.isReady()){stream.setExit();}
|
||||||
streamPage.master = true;
|
streamPage.master = true;
|
||||||
//Wipe tracklist semaphore. This is not done anywhere else in the codebase.
|
if (streamName.size()){
|
||||||
trackLock.unlink();
|
//Wipe tracklist semaphore. This is not done anywhere else in the codebase.
|
||||||
|
trackLock.unlink();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
stream = Util::RelAccX();
|
stream = Util::RelAccX();
|
||||||
trackList = Util::RelAccX();
|
trackList = Util::RelAccX();
|
||||||
|
|
Loading…
Add table
Reference in a new issue