All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tobias Schlemmer <keinstein_junior@gmx.net>
To: alsa-devel@alsa-project.org
Subject: cloning snd_seq_t (or creating one from client id)
Date: Mon, 31 Mar 2014 08:31:32 +0200	[thread overview]
Message-ID: <53390BC4.5090900@gmx.net> (raw)

Hi,

Recently, I came upon the following problem with the ALSA sequencer
interface:
I'm surprised that the upcoming version of RtMidi uses one ALSA client
per MIDI port.
As an end user I'd expect to see only one ALSA client per program
instance (e.g. using aconnect -i - o -l).
Asking for the reason of that change I got the answer that it has
something to do with broken multithread support.

Digging deeper into this problem I found out that sequencer handles
(snd_seq_t) are not thread safe.
So my question is:
Could you provide some way to implement multithreaded ALSA clients?

My idea is to provide some function
int snd_seq_clone(snd_seq_t * old, snd_seq_t ** new) /* clone a sequencer */
and/or
int snd_seq_create_from_client(int clientid, snd_seq_t ** new) /* create
a sequencer from a given client id */
and/or
int snd_seq_split_port(snd_seq_t * old, snd_seq_t ** new, int port) /*
create a sequencer that steels a port from old */

For the semantics I think cloned sequencers should act as if they don't
know each other.
Each one has its own set of ports. While the generation of port numbers
still uses the same counter. I don't expect creating a port to be that
time critical that it can't use locks.

If it helps to ease the implementation one could use a master sequencer
with some slaves. If the master sequencer is deleted the slaves are
automatically freed and must not be used anymore.

And if a subsequencer tries to access a port of another subsequncer,
ALSA could just return with an error.

Regards,

Tobias

P.S.: please, CC to me in answers.

             reply	other threads:[~2014-03-31  6:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-31  6:31 Tobias Schlemmer [this message]
2014-03-31 12:29 ` cloning snd_seq_t (or creating one from client id) Clemens Ladisch
2014-03-31 14:40   ` Tobias Schlemmer
2014-03-31 21:01     ` Clemens Ladisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53390BC4.5090900@gmx.net \
    --to=keinstein_junior@gmx.net \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.