Re: pthreads
- From: Vince Busam <vince phatnoise com>
- To: "Seisdedos Nuñez, Monserrat" <mseisdedos cirsa com>
- Cc: "gtk (E-mail)" <gtk-list gnome org>
- Subject: Re: pthreads
- Date: Thu, 18 Jul 2002 14:38:33 -0700 (PDT)
Instead of using threads, I'd use gtk_add_input_full() to set a callback
function to use when data is ready on stdin.
Vince
On Thu, 18 Jul 2002, "Seisdedos Nuñez, Monserrat" wrote:
>
> Hello everybody:
>
> I have a programm than read from the standar input using fgets, so it will
> block till there are some data ready to read.
> I want a progress bar to show activitie.
> Because the program blocks in fgets. the movement of the progress bar is no
> constant.
>
> So i create a pthread to move the progress bar as in the faq 5.2 indicate
>
> main()
> {
>
> g_thead_init(NULL);
> ....
> ...
> gdk_threads_enter();
> gtk_main();
> gdk_threads_leave();
> }
>
>
> callback_function()
> {
> ...
> pthead_create(thread_t,NULL, thread_function, progress_bar);
> fgets(....);
> ...
> }
>
> thread_function
> {
>
> while(1)
> {
> gdk_threads_enter();
> gtk_progess_set_value(progress_var, value);
> gdk_threads_leave();
> sleep(1);
> }
>
> }
>
>
> If i do this way, the thread will block in the gdk_threads_enter(),
> if i take away the gdk_threads_enter the thread progress, but it doesn't
> move the progress bar
> Can anybody helpme???
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
--
Vince Busam
http://www.phatnoise.com
- References:
- pthreads
- From: "Seisdedos Nuñez, Monserrat"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]