Пример #1
0
		static void teardown() throw() {
			if (is_destroyed()) {
				return;
			}
			scoped_lock_type lock(mutex());
			thread_callback& self = get_mutable_instance();
			self.dispose();
		}
Пример #2
0
		static void setup() {
			if (is_destroyed()) {
				return;
			}
			scoped_lock_type lock(mutex());
			thread_callback& self = get_mutable_instance();
			self.initialize();
		}
Пример #3
0
		static bool post(callback_type const& callback) {
			if (is_destroyed()) {
				return false;
			}
			scoped_lock_type lock(mutex());
			thread_callback& self = get_mutable_instance();
			self.initialize();
			self.callback_list_.push_back(callback);
			return ::PostMessage(self.window_handle_, KTL_WM_THREAD_CALLBACK, 0, 0) != 0;
		}
Пример #4
0
		static bool call_one() {
			if (is_destroyed()) {
				return false;
			}
			scoped_lock_type lock(mutex());
			thread_callback& self = get_mutable_instance();
			if (self.callback_list_.empty()) {
				return false;
			}
			self.callback_list_.front()();
			self.callback_list_.pop_front();
			return true;
		}
Пример #5
0
/** Check if segment has been destroyed
 * This can be used if the segment has been destroyed. This means that no
 * other process can connect to the shared memory segment. As long as some
 * process is attached to the shared memory segment the segment will still
 * show up in the list
 * @return true, if this shared memory segment has been destroyed, false
 *         otherwise
 */
bool
SharedMemory::is_destroyed() const
{
  return is_destroyed(__shared_mem_id);
}