[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnash-commit
Subject:    [Gnash-commit] /srv/bzr/gnash/trunk r11172: Adding
From:       Andrea_Palmatè <andrea () amigasoft ! net>
Date:       2009-06-27 16:32:26
Message-ID: E1MKcCh-0005WN-Tq () sv ! gnu ! org
[Download RAW message or body]

[Attachment #2 (text/plain)]

------------------------------------------------------------
revno: 11172
committer: Andrea Palmatè <andrea@amigasoft.net>
branch nick: gnash
timestamp: Sat 2009-06-27 18:32:26 +0200
message:
  Adding NotifyDeathMessage to the Audio Task
modified:
  libsound/aos4/sound_handler_ahi.cpp
  libsound/aos4/sound_handler_ahi.h

["r11172.diff" (r11172.diff)]

=== modified file 'libsound/aos4/sound_handler_ahi.cpp'
--- a/libsound/aos4/sound_handler_ahi.cpp	2009-06-27 15:26:16 +0000
+++ b/libsound/aos4/sound_handler_ahi.cpp	2009-06-27 16:32:26 +0000
@@ -125,7 +125,8 @@
     _audioOpened(false),
 	_closing(false),
 	_paused(true),
-	_started(false)
+	_started(false),
+	_fetching(false)
 {
     initAudio();
 }
@@ -137,9 +138,20 @@
 	// on class destruction we must kill the Audio thread
 	_closing = true;
 	_paused = true;
-	IDOS->Delay(80);
+	IDOS->Delay(30);
 	IExec->Signal((struct Task*)AudioPump,SIGBREAKF_CTRL_C);
+
+	IExec->WaitPort(_DMreplyport);
+	IExec->GetMsg(_DMreplyport);
+
+	if (_dmsg)			IExec->FreeSysObject(ASOT_MESSAGE, _dmsg); _dmsg = 0;
+	if (_DMreplyport) 	IExec->FreeSysObject(ASOT_PORT, _DMreplyport); _DMreplyport = 0;
 	
+	while (_fetching)
+	{
+		gnashSleep(100);
+	}
+
     lock.unlock();
 
     // we already locked, so we call
@@ -165,7 +177,22 @@
     if ( _audioOpened ) return; // nothing to do
 
 	log_debug(_("AOS4: Spawn Audio Process.."));
-
+	
+	_DMreplyport = (struct MsgPort*) IExec->AllocSysObjectTags(ASOT_PORT, TAG_DONE);
+	_dmsg 		 = (struct DeathMessage*) IExec->AllocSysObjectTags(ASOT_MESSAGE,
+																	ASOMSG_Size, sizeof(struct DeathMessage),
+																	ASOMSG_ReplyPort, _DMreplyport,
+																	TAG_DONE);
+	
+	if (!_dmsg || !_DMreplyport)
+	{
+		_audioOpened = false;
+		log_error(_("Unable to create Death Message for child!!"));
+		throw SoundException("Unable to create Death Message for child!!");
+	}
+	_dmsg->dm_Msg.mn_ReplyPort = _DMreplyport;
+	_dmsg->dm_Msg.mn_Length    = (uint16)sizeof(*_dmsg);
+	
 	AudioPump = (struct Process *) IDOS->CreateNewProcTags (
 		   							NP_Entry, 		(ULONG) audioTaskWrapper,
 						   			NP_Name,	   	PLAYERTASK_NAME,
@@ -176,6 +203,7 @@
 									NP_StackSize,   262144,
 									NP_Child,		TRUE,
 									NP_Priority,	PLAYERTASK_PRIORITY,
+									NP_NotifyOnDeathMessage, _dmsg,
 		   							NP_EntryData, 	this,
 						  			TAG_DONE);
 
@@ -343,10 +371,10 @@
 	    boost::mutex::scoped_lock lock(_mutex);
     	if (!_closing) 
     	{
+	    	_fetching = true;
 	    	if (to)
 	    		sound_handler::fetchSamples(to, nSamples);
-	    	else
-	    		return;
+    		_fetching = false;
     	}
 		
 		if (!_closing) return;

=== modified file 'libsound/aos4/sound_handler_ahi.h'
--- a/libsound/aos4/sound_handler_ahi.h	2009-06-22 22:05:53 +0000
+++ b/libsound/aos4/sound_handler_ahi.h	2009-06-27 16:32:26 +0000
@@ -86,7 +86,11 @@
 	bool _closing;
 	bool _paused;
 	bool _started;
+	bool _fetching;
 
+	struct DeathMessage *_dmsg; 	// the child Death Message
+	struct MsgPort *_DMreplyport;	// and its port
+	
     /// Mutex for making sure threads doesn't mess things up
     boost::mutex _mutex;
 



_______________________________________________
Gnash-commit mailing list
Gnash-commit@gnu.org
http://lists.gnu.org/mailman/listinfo/gnash-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic