[openbeos-midi] Re: BMidiEndPoint

  • From: Michael Pfeiffer <michael.pfeiffer@xxxxxxxxx>
  • To: openbeos-midi@xxxxxxxxxxxxx
  • Date: Thu, 10 Oct 2002 08:32:59 -0700

>That would be my bet too. Basically, you would implement it
>something like this, in pseudo code:

[code snipped]

>Like I said, this is pseudo code and you may want to think about the
>way you use the semaphores (the example above probably isn't
>entirely correct). Maybe semaphores are a bit overkill for this,
>actually, and an atomic_add() is sufficient. In any case, you should
>protect the counter from concurrent access by multiple threads.

For an implementation with atomic_add see "class Object" in
BeUtils.h in directory current/src/servers/print:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/open-beos/current/src/servers/print/BeUtils.h?rev=1.2&content-type=text/vnd.viewcvs-markup

- Michael




Other related posts: