Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: ki.ber.kom.uni.st <ki.ber@kom.uni.st>
To: ALSA development <alsa-devel@alsa-project.org>
Subject: pyalsa with threads allowed for python (Py_BEGIN_ALLOW_THREADS & Py_END_ALLOW_THREADS)
Date: Sat, 17 May 2008 18:40:04 +0200	[thread overview]
Message-ID: <95e4e4ce0805170940wb1aa76et3003ab926bfe03eb@mail.gmail.com> (raw)

i develop my app iterating ipython interactive sessions with pasting
the good code into files (which eventually being loaded back to
ipython sessions)...

for that kind of development i need pyalsa to run in python threads...
when i did (as it is now) alsaseq.Sequencer.receive_events(100) in
infinite loop of pyqt4 thread it always steal interaction from ipython
and it makes interaction unusable... it gets back every now and then
almost randomly and definitively not frequent enough to be usable..
hope this description explained enough of what's happening...

the solution was to make time.sleep(.001) at the end of while True:
loop... it took me several hours to find out the solution... i was
quite happy with the solution but my guru friends told me that's dirty
and i'm lame...

the other solution is in particular case of receive_events to put
Py_*_ALLOW_THREADS

    Py_BEGIN_ALLOW_THREADS;
    ret = poll(self->receive_fds, self->receive_max, timeout);
    Py_END_ALLOW_THREADS;

around poll...

this url should explain this strange phenomena (to me) to the real
programmers: http://www.python.org/doc/1.5.2/api/threads.html

in my case my programming guru akapav sort it out after couple of
minuts checking the code...

hope this is of some interest to pyalsa devs... i definitively would
need most of the functions being ready to run in threads....

thanx.. keep up the good work...

             reply	other threads:[~2008-05-17 16:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-17 16:40 ki.ber.kom.uni.st [this message]
2008-05-19  6:45 ` pyalsa with threads allowed for python (Py_BEGIN_ALLOW_THREADS & Py_END_ALLOW_THREADS) Jaroslav Kysela

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=95e4e4ce0805170940wb1aa76et3003ab926bfe03eb@mail.gmail.com \
    --to=ki.ber@kom.uni.st \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox