Commit 3767759a authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCEventManager: Code cleanup. (Patch by Enrique Osuna).

parent 55bc65e1
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
/* This object is here to ensure safe inter thread communication */ /* This object is here to ensure safe inter thread communication */
@interface VLCEventManager : NSObject @interface VLCEventManager : NSObject
{ {
NSMutableArray *messageQueue; NSMutableArray * messageQueue;
pthread_t dispatcherThread; pthread_t dispatcherThread;
pthread_mutex_t queueLock; pthread_mutex_t queueLock;
pthread_cond_t signalData; pthread_cond_t signalData;
......
...@@ -63,7 +63,7 @@ static void * EventDispatcherMainLoop(void * user_data) ...@@ -63,7 +63,7 @@ static void * EventDispatcherMainLoop(void * user_data)
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
struct message * message, * message_newer = NULL; struct message * message, * message_newer = NULL;
NSData *dataMessage; NSData * dataMessage;
int i; int i;
/* Sleep a bit not to flood the interface */ /* Sleep a bit not to flood the interface */
...@@ -72,7 +72,7 @@ static void * EventDispatcherMainLoop(void * user_data) ...@@ -72,7 +72,7 @@ static void * EventDispatcherMainLoop(void * user_data)
pthread_mutex_lock( [self queueLock] ); pthread_mutex_lock( [self queueLock] );
/* Wait until we have something on the queue */ /* Wait until we have something on the queue */
while([[self messageQueue] count] <= 0 ) while( [[self messageQueue] count] <= 0 )
{ {
pthread_cond_wait( [self signalData], [self queueLock] ); pthread_cond_wait( [self signalData], [self queueLock] );
} }
...@@ -87,14 +87,14 @@ static void * EventDispatcherMainLoop(void * user_data) ...@@ -87,14 +87,14 @@ static void * EventDispatcherMainLoop(void * user_data)
{ {
for( i = 0; i < [[self messageQueue] count]-1; i++ ) for( i = 0; i < [[self messageQueue] count]-1; i++ )
{ {
message_newer = (struct message *)[(NSData *)[[self messageQueue] objectAtIndex: i] bytes]; message_newer = (struct message *)[(NSData *)[[self messageQueue] objectAtIndex:i] bytes];
if( message_newer->type == VLCNotification && if( message_newer->type == VLCNotification &&
message_newer->target == message->target && message_newer->target == message->target &&
[message_newer->u.name isEqualToString:message->u.name] ) [message_newer->u.name isEqualToString:message->u.name] )
{ {
[message_newer->target release]; [message_newer->target release];
[message->u.name release]; [message_newer->u.name release];
[[self messageQueue] removeObjectAtIndex: i]; [[self messageQueue] removeObjectAtIndex:i];
i--; i--;
continue; continue;
} }
...@@ -112,8 +112,8 @@ static void * EventDispatcherMainLoop(void * user_data) ...@@ -112,8 +112,8 @@ static void * EventDispatcherMainLoop(void * user_data)
message_newer->sel == message->sel ) message_newer->sel == message->sel )
{ {
if(!newArg) if(!newArg)
newArg = [NSMutableArray arrayWithArray: message->u.object]; newArg = [NSMutableArray arrayWithArray:message->u.object];
[newArg addObjectsFromArray: message_newer->u.object]; [newArg addObjectsFromArray:message_newer->u.object];
[message_newer->target release]; [message_newer->target release];
[message_newer->u.object release]; [message_newer->u.object release];
[[self messageQueue] removeObjectAtIndex: i]; [[self messageQueue] removeObjectAtIndex: i];
...@@ -142,7 +142,6 @@ static void * EventDispatcherMainLoop(void * user_data) ...@@ -142,7 +142,6 @@ static void * EventDispatcherMainLoop(void * user_data)
else else
[self performSelectorOnMainThread:@selector(callObjectMethodWithArgs:) withObject:[dataMessage retain] /* released in the call */ waitUntilDone: YES]; [self performSelectorOnMainThread:@selector(callObjectMethodWithArgs:) withObject:[dataMessage retain] /* released in the call */ waitUntilDone: YES];
pthread_mutex_lock( [self queueLock] ); pthread_mutex_lock( [self queueLock] );
[[self messageQueue] removeLastObject]; [[self messageQueue] removeLastObject];
pthread_mutex_unlock( [self queueLock] ); pthread_mutex_unlock( [self queueLock] );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment