RE: What is the minimum number of lines to update a gui window without user clicking a button



I'm pretty sure this is NOT thread safe. You generally need a dispatcher for that in from. I would expect lockups without a dispatcher.

Sent from my Android phone using TouchDown (www.nitrodesk.com)

-----Original Message-----
From: Markus Elfring [Markus Elfring web de]
Received: Tuesday, 20 Aug 2013, 1:44am
To: L. D. James [ljames apollo3 com]
CC: gtkmm-list gnome org [gtkmm-list gnome org]
Subject: Re: What is the minimum number of lines to update a gui window without user clicking a button


> HelloWorld::HelloWorld() : m_textview() {
>
>     add(m_textview);
>     m_textview.show();
>     Glib::Thread::create(sigc::mem_fun(*this, &HelloWorld::cpp_app),
> true);
> }
[...]
> void HelloWorld::cpp_app() {
>     string texttoprint = "";
>     Glib::RefPtr<Gtk::TextBuffer> m_refTextBuffer;
>     m_refTextBuffer = Gtk::TextBuffer::create();
>     string runit(std::string c);
>
>     texttoprint +=
>             "About to run a number of c++ functions\nand display the
> results\n";
>     m_refTextBuffer->set_text(texttoprint);
>     m_textview.set_buffer(m_refTextBuffer);
>
>     sleep(10);  // This sleep function represents any c++ function
> performaing a task

I would like to clarify implementation details a bit more from this
programming attempt. Can it be that the referenced text buffer is
written in a thread-unsafe way here?
How do think about to apply improved techniques and software ingredients
like locks for memory consistency?
(Andrew Potter and Gavin Lambert suggested also an alternative program
structure. -
https://mail.gnome.org/archives/gtkmm-list/2013-August/msg00135.html )

Regards,
Markus
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]