javauis/mmapi_akn/baseline/src/cmmaoutputstreamevent.cpp
branchRCL_3
changeset 18 9ac0a0a7da70
parent 14 04becd199f91
--- a/javauis/mmapi_akn/baseline/src/cmmaoutputstreamevent.cpp	Tue May 11 16:07:20 2010 +0300
+++ b/javauis/mmapi_akn/baseline/src/cmmaoutputstreamevent.cpp	Tue May 25 12:34:19 2010 +0300
@@ -20,7 +20,11 @@
 
 #include "cmmaoutputstreamevent.h"
 
-
+CMMAOutputStreamEvent::~CMMAOutputStreamEvent()
+	{
+		iMutex.Close();
+	}
+	
 CMMAOutputStreamEvent::CMMAOutputStreamEvent(jmethodID aHandleEventMethod,
         jobject aNotifyObject)
         : CMMAEvent(EReusableEvent),
@@ -28,24 +32,31 @@
         iListenerObject(aNotifyObject)
 {
     iState = EMMAEventNotActive;
+    iMutex.CreateLocal();
 }
 
 void CMMAOutputStreamEvent::SetLength(TInt aLength)
 {
+		iMutex.Wait();
     iLength = aLength;
     iState = EMMAEventActive;
+    iMutex.Signal();
 }
 
 
 void CMMAOutputStreamEvent::SetStatus(TInt aStatus)
 {
+		iMutex.Wait();
     iStatus = aStatus;
     iState = EMMAEventActive;
+    iMutex.Signal();
 }
 
 void CMMAOutputStreamEvent::SetState(CMMAOutputStreamEvent::TMMAOutputStreamState aState)
 {
+		iMutex.Wait();
     iState = aState;
+    iMutex.Signal();
 }
 
 CMMAOutputStreamEvent::TMMAOutputStreamState CMMAOutputStreamEvent::State()
@@ -57,7 +68,7 @@
 {
     DEBUG_INT2("CMMAOutputStreamEvent::Dispatch, len=%d status=%d-",
                iLength, iStatus);
-
+		iMutex.Wait();
     if (iState == EMMAEventActive)
     {
         aJni.CallVoidMethod(iListenerObject,
@@ -74,6 +85,7 @@
 
         delete this;
     }
+    iMutex.Signal();
     // else event is not active
 }