Commit 94af477c authored by Faustino Osuna's avatar Faustino Osuna

MacOSX/Framework/VLCEventManager: Forgot in previous commit. Code clean...

MacOSX/Framework/VLCEventManager: Forgot in previous commit. Code clean up/documentation.  Standardized the way duplicate notifications are consolidated.
parent 146cc65c
...@@ -25,21 +25,64 @@ ...@@ -25,21 +25,64 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <pthread.h> #import <pthread.h>
/* This object is here to ensure safe inter thread communication */ /**
* The VLCEventManager class provides a safe way for inter-thread communications.
*/
@interface VLCEventManager : NSObject @interface VLCEventManager : NSObject
{ {
NSMutableArray * messageQueue; NSMutableArray * messageQueue; //< Holds a queue of messages.
pthread_t dispatcherThread; pthread_t dispatcherThread; //< Thread responsible for dispatching messages.
pthread_mutex_t queueLock; pthread_mutex_t queueLock; //< Queue lock.
pthread_cond_t signalData; pthread_cond_t signalData; //< Data lock.
} }
/* Return the default manager */ /* Factories */
/**
* Returns the shared VLCEventManager. There should only be one instance of this class.
* \return Shared event manager.
*/
+ (id)sharedManager; + (id)sharedManager;
/* Operations */
/**
* Sends a message to the target's delegate on the main thread.
* \discussion The main thread is the one in which the main run loop is run, which usually
* means the one in which the NSApplication object receives events. The method is performed
* when the main thread runs the run loop in one of the common run loop modes (as specified
* in the CFRunLoop documentation).
*
* The receiver is retained until the call is finished.
* \param aTarget The target object who's delegate should receive the specified message.
* \param aSelector A selector that identifies the method to invoke. The method should not
* have a significant return value and should take a single argument of type NSNotification,
* or no arguments.
*
* See ÒSelectorsÓ for a description of the SEL type.
* \param aNotificiationName The name of the notification that should be sent to the
* distributed notification center.
*/
- (void)callOnMainThreadDelegateOfObject:(id)aTarget - (void)callOnMainThreadDelegateOfObject:(id)aTarget
withDelegateMethod:(SEL)aSelector withDelegateMethod:(SEL)aSelector
withNotificationName:(NSString *)aNotificationName; withNotificationName:(NSString *)aNotificationName;
/**
* Sends a message to the target on the main thread.
* \discussion The main thread is the one in which the main run loop is run, which usually
* means the one in which the NSApplication object receives events. The method is performed
* when the main thread runs the run loop in one of the common run loop modes (as specified
* in the CFRunLoop documentation).
*
* The receiver and arg are retained until the call is finished.
* \param aTarget The target object who should receive the specified message.
* \param aSelector A selector that identifies the method to invoke. The method should not
* have a significant return value and should take a single argument of type id,
* or no arguments.
*
* See ÒSelectorsÓ for a description of the SEL type.
* \param arg The argument to pass in the message. Pass nil if the method does not take an
* argument.
* distributed notification center.
*/
- (void)callOnMainThreadObject:(id)aTarget - (void)callOnMainThreadObject:(id)aTarget
withMethod:(SEL)aSelector withMethod:(SEL)aSelector
withArgumentAsObject:(id)arg; withArgumentAsObject:(id)arg;
......
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