accessing widgets from different threads



Hi list,
I've got a gtksourceview widget (but this post isn't about the fact that
it's gtksourceview widget, it could be any widget) and I'd like to run
some regular expressions on the text in the source buffer when the user
isn't typing. I'd like the regular expressions to run in a separate
thread to keep the application responsive. So the questions is: how can
I get the text out of a widget when the user could be typing in it any
any time? I know I have to serialize access to the widget but when there
is another thread doing all of the GUI interaction I don't see how I can
tell it to not deal with a given widget at any given moment. I only need
to stop the GUI thread so I can get a copy of the current text buffer,
but I'm afraid at that moment of the copy the user may hit a key and
break something in the widget.

I can't just get a copy of the source every time the user hits a key and
changes the text because that would be too much copying. I need to wait
a second or two after the user has stopped typing then get the copy.

thanks,
Chris.


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