Skip to content

Commit ba30813

Browse files
committed
Add IOMutex to IO Operations
1 parent e7a0615 commit ba30813

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

BlackHole/BlackHole.c

+5
Original file line numberDiff line numberDiff line change
@@ -3885,6 +3885,9 @@ static OSStatus BlackHole_DoIOOperation(AudioServerPlugInDriverRef inDriver, Aud
38853885
FailWithAction(inDeviceObjectID != kObjectID_Device, theAnswer = kAudioHardwareBadObjectError, Done, "BlackHole_DoIOOperation: bad device ID");
38863886
FailWithAction((inStreamObjectID != kObjectID_Stream_Input) && (inStreamObjectID != kObjectID_Stream_Output), theAnswer = kAudioHardwareBadObjectError, Done, "BlackHole_DoIOOperation: bad stream ID");
38873887

3888+
// IO Lock
3889+
pthread_mutex_lock(&gDevice_IOMutex);
3890+
38883891
/* READ INPUT */
38893892
if(inOperationID == kAudioServerPlugInIOOperationReadInput)
38903893
{
@@ -3960,6 +3963,8 @@ static OSStatus BlackHole_DoIOOperation(AudioServerPlugInDriverRef inDriver, Aud
39603963
// clear the io buffer
39613964
memset(ioMainBuffer, 0, inIOBufferByteSize);
39623965
}
3966+
3967+
pthread_mutex_unlock(&gDevice_IOMutex);
39633968

39643969
Done:
39653970
return theAnswer;

0 commit comments

Comments
 (0)