If I'm not wrong there is no easy way to make a c++0x thread cancellable. I'm wondering if it's legal to use GCancellable mixing it with c++0x thread.
If the answer is
I guess I should use glib threads or it's not so legal too?
I am not very familiar with
GCancellable. After a quick read through, it appears to be a hierarchical notification system.
If that is the case then yes you can easily mix
There is no easy way to make a
This is wrong.
There is no non-zero cost way to make all
This is correct.
The problem is providing a general solution. Notification is easy enough. The hard part is making sure the thread sees the notification. The thread may be blocked on a mutex or IO. You cannot just kill the thread. All sorts of bad can occur.
Each individual implementation is free to implement their own cancellation system tailored to you particular needs.
If you need to be interruptable from a blocking mutex, make sure you only use timed_mutexes, and that you call
g_cancellable_is_cancelled frequently enough that your thread will cancel as needed.
You mean something like boost's interruptible threads?
This aspect didn't make it into the standard but you can derive from
std::thread to offer a protected
check_interrupted() method which throws if someone called a public
I wouldn't bother mixing with Gnome's thread constructs. Sounds like more trouble than it's worth.