Re: Thread safety?



>I have been getting some strange segfaults, and at the moment I believe
>it is something to do with a thread I have running which adds items into
>a (derived) TreeStore. Basically, this thread gets a message, which
>tells it to add an item into the store. Sometimes (not always), this
>operation segfaults, usually when I'm trying to access a row.
>
>Is the TreeStore class (and any related class) thread safe? I am using
>pthreads (I'd like to avoid using anything GTK/Glib specific for
>threading since, in the future, I'll probably be unplugging gtkmm).

no part of gtkmm is thread safe without explicit locks on your
part. gtk, gtkmm and almost all other X Window toolkits do not include
thread safety by default because of the overhead of supporting it when
it is not used. unix traditionally used processes, not threads, and so
the situation is different than the one typically found under windows.

plenty of us write thread-based programs using gtkmm, and we stick
generally to the model of only having a single thread make any GUI
calls. Glib::Dispatcher is used to get messages/events etc. into the
GUI thread.

--p




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