[haiku-3rdparty-dev] Re: Problem sending/receiving app defined msgs

  • From: hudsonco1@xxxxxxx
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Sun, 5 Dec 2010 18:32:03 -0500 (EST)

Guys,


Thanks for taking the time to think about this. I might as well put some cards 
on the table. I am working on
another article. This one is on pervasive multithreading and how this makes 
some tasks easier to do in Haiku.
In this case an application starts, spawns 5 instances, 4 of them remain on 
screen and send messages to each 
other. Each application acts as a mind of remote control for any other 
application to play an audio file.


The program I am writing is not complicated but shows some interesting 
techniques: Using BMessenger, 
sending messages between applications, playing audio from a resource, etc. The 
real goal is of course to 
bring more eyeballs to Haiku and invite more application developers to use 
Haiku for interesting projects. 


I am a beginner in creating thread safe code, but I want the code to be safe 
and to run on any number of 
processors. At some point I would like to post the source code and request a 
code review.


Here is another question. Is there a bug in BFileGameSound? I used it to play 
an audio file from disk. It worked once,
then afterwards doesn't play, gives an error about a bad port. Even after 
rebooting. 


Thanks,
Andrew









-----Original Message-----
From: Stephan Assmus <superstippi@xxxxxx>
To: haiku-3rdparty-dev <haiku-3rdparty-dev@xxxxxxxxxxxxx>
Sent: Sun, Dec 5, 2010 11:48 am
Subject: [haiku-3rdparty-dev] Re: Problem sending/receiving app defined msgs


Hi,

Von: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
> Stephan Aßmus <superstippi@xxxxxx> wrote:
> > Am Sonntag, den 05.12.2010, 14:15 +0100 schrieb Axel Dörfler:
> > > Using the window as pointer is indeed not thread-safe - creating a 
> > > BMessenger out of it is, though.
> > I remember having traced this code before and I am pretty sure I have
> > found out that invoking PostMessage() on a stale BLooper pointer is
> > save. Making a BMessenger from a stale BLooper pointer boils down to 
> > the
> > same code behind the scenes. On the one hand I can't trust my memory 
> > too
> > well these days, but on the other hand I am too lazy to trace the 
> > code
> > again. So I'll leave that up to you to prove me wrong, if you don't
> > believe me. :-)
> 
> I know you are right, but if you have any further questions, you just 
> have to read through Ingo's mail who goes into detail of everything, 
> and is completely correct, too :-)

Yes I saw that mail and was happy about the insights contained. I just hope 
that 
when you wrote your initial reply you hadn't seen the mail I already wrote. :-P

Best regards,
-Stephan



 

Other related posts: