Fixed all semaphore instances not being cleaned up properly.
This commit is contained in:
parent
dda9ed54b4
commit
f4b296164e
14 changed files with 77 additions and 63 deletions
|
|
@ -10,10 +10,7 @@ namespace TS {
|
|||
Stream::Stream(bool _threaded){
|
||||
threaded = _threaded;
|
||||
if (threaded){
|
||||
globalSem.open("MstTSInputLock", O_CREAT | O_EXCL | O_RDWR, ACCESSPERMS, 1);
|
||||
if (!globalSem) {
|
||||
globalSem.open("MstTSInputLock", O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
}
|
||||
globalSem.open("MstTSInputLock", O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
if (!globalSem) {
|
||||
FAIL_MSG("Creating semaphore failed: %s", strerror(errno));
|
||||
threaded = false;
|
||||
|
|
@ -23,6 +20,12 @@ namespace TS {
|
|||
}
|
||||
}
|
||||
|
||||
Stream::~Stream(){
|
||||
if (threaded){
|
||||
globalSem.unlink();
|
||||
}
|
||||
}
|
||||
|
||||
void Stream::parse(char * newPack, unsigned long long bytePos) {
|
||||
Packet newPacket;
|
||||
newPacket.FromPointer(newPack);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue