Re: hang on leopard

Hi Alex,

Thanks for the quick reply. I appreciate it.

My apps has 3 user threads:

  1. A dialog box that shows numbers in flashing fashion. This dialog has
    a number thread that shows a number, sleep, show next number, sleep,

  2. A dialog box that shows running time (one thread), and another thread
    running waiting for the number thread to finish showing the numbers, and
    wait for a user to type in the result of adding up those numbers.

BTW, at one point, my code is working fine on leopard, but it keeps
giving me the following error once every 5 tries or so:

*** Exception handlers were not properly removed. Some code has jumped
or returned out of an NS_DURING…NS_HANDLER region without using the
NS_VOIDRETURN or NS_VALUERETURN macros.

And, I was trying to so many things to try to get rid of that error, and
I’m now in a state where when I run the code, it works like a champ in
the 1st try, but when I try it again for the second time, the whole
thing hang … I.e., beach ball spinning, and I have to kill the
process to get out of it. Note that as I said in my original post, the
same code runs fine on Windows XP …

I could be wrong, but I don’t think I run GUI thread … I have a dialog
based class, and I create a thread or two inside the class. In other
words, I do not use Thread.new to initiate the dialog class.

I tried to make smaller example, but the problem did not show up. The
project itself is not big since I’m trying things out. only 4 small ruby
files. I do not mind sending the files if you are interested in seeing
and running it.

Sincerely … Zhang P.

----- Original Message ----
From: Alex F. [email protected]
To: General discussion of wxRuby [email protected]
Sent: Monday, February 18, 2008 8:42:15 AM
Subject: Re: [wxruby-users] hang on leopard

Hi

Zhang
Peng
wrote:

I’m
a
newbie
to
ruby
and
wxruby.
Welcome

I’m
trying
to
create
1
frame
(the
app)
that
creates
2
dialog
boxes.

Each
dialog
box
has
wxtextctrl,
and
1
dialog
class
has
1
thread
and

the
other
has
2
threads.
Why
are
you
using
separate
threads

what
sort
of
work
is
being
done
in
the
subordinate
threads?
Is
it
the
GUI
that
is
hanging,
or
the
non-GUI
tasks?

I
would
definitely
not
advise
running
wxRuby
GUI
code
outside
the
main
GUI
thread.

Just
out
of
curiosity,
I
tried
to
run
the
same
code
with
no
changes
on

Windows
XP
running
under
Parallels
on
my
Leopard,
and
to
my
surprise,

it
works
like
a
champ

Any
advise
on
what
I
might
be
doing
wrong?
Hard
to
say
anything
further
without
seeing
a
short
working
example.

cheers
alex


wxruby-users
mailing
list
[email protected]
http://rubyforge.org/mailman/listinfo/wxruby-users

  ____________________________________________________________________________________

Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Zhang

Zhang P. wrote:

  1. A dialog box that shows numbers in flashing fashion. This dialog
    has a number thread that shows a number, sleep, show next number,
    sleep, …

  2. A dialog box that shows running time (one thread), and another
    thread running waiting for the number thread to finish showing the
    numbers, and wait for a user to type in the result of adding up those
    numbers.
    It sounds like you are using the Threads just to time events rather than
    carry out more complex background tasks. In this case I would strongly
    recommend that you use Wx::Timer directly. This will give you more
    accurate timing than using threads and sleep, and will avoid the
    complexity of using threads as well.

As of 1.9.4, there’s simple idioms for using Timer:

Wx::Timer.every(milliseconds) do

repeated event

end

Wx::Timer.after(milliseconds) do

delayed event

end

There’s an example of a ticking clock in bigdemo/wxStatusBar.rbw in the
samples, which uses Wx::Timer. This might be helpful.

cheers
alex