[linux-audio-dev] problems creating/managing pthread stuff (audio-app related)

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] problems creating/managing pthread stuff (audio-app related)
From: Ivica Bukvic (bukvicic_AT_email.uc.edu)
Date: Wed Nov 21 2001 - 19:53:48 EET


Hi all! Currently I am working on an app that needs to have a timer set
up as a separate thread, but the problem is that I've been designing the
whole project in Kdevelop (using qt), and my main window is one big
Instance of a class which also possesses a Method which is responsible
for updating the Timer gui (i.e. milliseconds, seconds, minutes etc.).
Where the problem starts is that when I implement the timer within the
class itself, then when the Timer starts, the rest of the gui becomes
non-responsive due to fact that it is stuck in an infinite loop counting
time. So, I figured I need to create a pthread which would count time
and interface with the Public Method of the class, feeding it the
updated time, and updating the gui. But, here's where the woes start,
sicne I am very inexperienced with pthreads (I tried using fork, but
fork did not work for me, please correct me if I am wrong, but it seems
that it does not interface well with classes and object oriented code),
so I am not sure as to how to make pthread aware of the instance of the
gui class. Every time I make the app compile, it ends up crashing at the
point where the newly created pthread tries to call the instance of the
class, which tells me that it is unable to point to it properly, even
though I've defined the instance of the class as being STATIC. Could
someone please explain in few brief sentences as to how do I make
pthreaded function aware of the class (do I have to send an argument to
the pthread_create which is a pointer to the instance? if so how?) so
that the app does not crash. Please provide exact example code, since
none of the pthread code I've stumbled accross so far did not have this
kind of situation (most of them passed a char or something similarly
simplistic as an arg to the pthreaded function). Any help would be
greatly appreciated! Sincerely,

Ivica Bukvic


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Wed Nov 21 2001 - 19:47:40 EET