Exemplo n.º 1
0
/*!	Notifies all interested listeners of this transaction about the \a event.
	If \a event is a closing event (ie. TRANSACTION_ENDED, and
	TRANSACTION_ABORTED), all listeners except those listening to
	TRANSACTION_WRITTEN will be removed.
*/
static void
notify_transaction_listeners(block_cache* cache, cache_transaction* transaction,
	int32_t event)
{
	bool isClosing = is_closing_event(event);
	bool isWritten = is_written_event(event);

	ListenerList::Iterator iterator = transaction->listeners.GetIterator();
	while (iterator.HasNext()) {
		cache_listener* listener = iterator.Next();

		bool remove = (isClosing && !is_written_event(listener->events))
			|| (isWritten && is_written_event(listener->events));
		if (remove)
			iterator.Remove();

		if ((listener->events & event) != 0)
			add_notification(cache, listener, event, remove);
		else if (remove)
			delete_notification(listener);
	}

	// This must work asynchronously in the kernel, but since we're not using
	// most transaction events, we can do it here.
	flush_pending_notifications(cache);
}
Exemplo n.º 2
0
void
Team::_NotifyTeamRenamed()
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->TeamRenamed(Event(TEAM_EVENT_TEAM_RENAMED, this));
	}
}
Exemplo n.º 3
0
void
Team::_NotifyThreadRemoved(Thread* thread)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->ThreadRemoved(ThreadEvent(TEAM_EVENT_THREAD_REMOVED, thread));
	}
}
Exemplo n.º 4
0
void
Team::_NotifyImageRemoved(Image* image)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->ImageRemoved(ImageEvent(TEAM_EVENT_IMAGE_REMOVED, image));
	}
}
Exemplo n.º 5
0
void
TeamsWindow::_NotifySelectedInterfaceChanged(TargetHostInterface* interface)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->SelectedInterfaceChanged(interface);
	}
}
Exemplo n.º 6
0
/*
 * vislib::net::TcpServer::fireServerStopped
 */
void vislib::net::TcpServer::fireServerStopped(void) {
    this->lock.Lock();
    ListenerList::Iterator it = this->listeners.GetIterator();
    while (it.HasNext()) {
        it.Next()->OnServerStopped();
    }
    this->lock.Unlock();
}
Exemplo n.º 7
0
void
StackFrame::NotifyValueRetrieved(Variable* variable, TypeComponentPath* path)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->StackFrameValueRetrieved(this, variable, path);
	}
}
Exemplo n.º 8
0
void
Team::NotifyStopImageNameAdded(const BString& name)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->StopOnImageLoadNameAdded(
			ImageLoadNameEvent(TEAM_EVENT_IMAGE_LOAD_NAME_ADDED, this, name));
	}
}
Exemplo n.º 9
0
void
Team::NotifyImageDebugInfoChanged(Image* image)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->ImageDebugInfoChanged(
			ImageEvent(TEAM_EVENT_IMAGE_DEBUG_INFO_CHANGED, image));
	}
}
Exemplo n.º 10
0
void
Team::NotifyThreadStackTraceChanged(Thread* thread)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->ThreadStackTraceChanged(
			ThreadEvent(TEAM_EVENT_THREAD_STACK_TRACE_CHANGED, thread));
	}
}
Exemplo n.º 11
0
void
Team::NotifyThreadCpuStateChanged(Thread* thread)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->ThreadCpuStateChanged(
			ThreadEvent(TEAM_EVENT_THREAD_CPU_STATE_CHANGED, thread));
	}
}
Exemplo n.º 12
0
/*
 * vislib::net::CommServer::fireServerStarted
 */
void vislib::net::CommServer::fireServerStarted(void) {
    VLSTACKTRACE("CommServer::fireServerStarted", __FILE__, __LINE__);
    this->listeners.Lock();
    ListenerList::Iterator it = this->listeners.GetIterator();
    while (it.HasNext()) {
        it.Next()->OnServerStarted(*this);
    }
    this->listeners.Unlock();
}
Exemplo n.º 13
0
void
Team::NotifyMemoryChanged(target_addr_t address, target_size_t size)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->MemoryChanged(MemoryChangedEvent(
			TEAM_EVENT_MEMORY_CHANGED, this, address, size));
	}
}
Exemplo n.º 14
0
void
Team::NotifyUserBreakpointChanged(UserBreakpoint* breakpoint)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->UserBreakpointChanged(UserBreakpointEvent(
			TEAM_EVENT_USER_BREAKPOINT_CHANGED, this, breakpoint));
	}
}
Exemplo n.º 15
0
void
Team::NotifyCoreFileChanged(const char* targetPath)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->CoreFileChanged(CoreFileChangedEvent(
			TEAM_EVENT_CORE_FILE_CHANGED, this, targetPath));
	}
}
Exemplo n.º 16
0
void
Team::NotifyDebugReportChanged(const char* reportPath)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->DebugReportChanged(DebugReportEvent(
			TEAM_EVENT_DEBUG_REPORT_CHANGED, this, reportPath));
	}
}
Exemplo n.º 17
0
void
Team::NotifyWatchpointChanged(Watchpoint* watchpoint)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->WatchpointChanged(WatchpointEvent(
			TEAM_EVENT_WATCHPOINT_CHANGED, this, watchpoint));
	}
}
Exemplo n.º 18
0
void
Team::NotifyStopOnImageLoadChanged(bool enabled, bool useImageNameList)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->StopOnImageLoadSettingsChanged(
			ImageLoadEvent(TEAM_EVENT_IMAGE_LOAD_SETTINGS_CHANGED, this,
				enabled, useImageNameList));
	}
}
Exemplo n.º 19
0
void
Team::NotifyConsoleOutputReceived(int32 fd, const BString& output)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->ConsoleOutputReceived(
			ConsoleOutputEvent(TEAM_EVENT_CONSOLE_OUTPUT_RECEIVED, this,
				fd, output));
	}
}
Exemplo n.º 20
0
/*!	Removes and deletes all listeners that are still monitoring this
	transaction.
*/
static void
remove_transaction_listeners(block_cache* cache, cache_transaction* transaction)
{
	ListenerList::Iterator iterator = transaction->listeners.GetIterator();
	while (iterator.HasNext()) {
		cache_listener* listener = iterator.Next();
		iterator.Remove();

		delete_notification(listener);
	}
}
Exemplo n.º 21
0
void
Team::NotifyDefaultSignalDispositionChanged(int32 disposition)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->DefaultSignalDispositionChanged(
			DefaultSignalDispositionEvent(
				TEAM_EVENT_DEFAULT_SIGNAL_DISPOSITION_CHANGED, this,
				disposition));
	}
}
Exemplo n.º 22
0
void
Team::NotifyCustomSignalDispositionChanged(int32 signal, int32 disposition)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->CustomSignalDispositionChanged(
			CustomSignalDispositionEvent(
				TEAM_EVENT_CUSTOM_SIGNAL_DISPOSITION_CHANGED, this,
				signal, disposition));
	}
}
Exemplo n.º 23
0
void
Team::NotifyCustomSignalDispositionRemoved(int32 signal)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->CustomSignalDispositionRemoved(
			CustomSignalDispositionEvent(
				TEAM_EVENT_CUSTOM_SIGNAL_DISPOSITION_REMOVED, this,
				signal, SIGNAL_DISPOSITION_IGNORE));
	}
}
Exemplo n.º 24
0
/*
 * vislib::net::TcpServer::fireNewConnection
 */
bool vislib::net::TcpServer::fireNewConnection(Socket& socket, 
         const IPEndPoint& addr) {
    bool retval = false;

    this->lock.Lock();
    ListenerList::Iterator it = this->listeners.GetIterator();
    while (it.HasNext()) {
        if ((retval = it.Next()->OnNewConnection(socket, addr))) {
            break;
        }
    }

    this->lock.Unlock();
    return retval;
}
Exemplo n.º 25
0
/*
 * vislib::net::CommServer::fireServerError
 */
bool vislib::net::CommServer::fireServerError(
        const vislib::Exception& exception) {
    VLSTACKTRACE("CommServer::fireServerError", __FILE__, __LINE__);
    bool retval = true;

    this->listeners.Lock();
    ListenerList::Iterator it = this->listeners.GetIterator();
    while (it.HasNext()) {
        retval = it.Next()->OnServerError(*this, exception) && retval;
    }
    this->listeners.Unlock();

    VLTRACE(Trace::LEVEL_VL_ANNOYINGLY_VERBOSE, "CommServer "
        "received exit request from registered error listener: %s\n", 
        !retval ? "yes" : "no");
    return retval;
}
Exemplo n.º 26
0
/*
 * vislib::net::CommServer::fireNewConnection
 */
bool vislib::net::CommServer::fireNewConnection(
        SmartRef<AbstractCommClientChannel>& channel) {
    VLSTACKTRACE("CommServer::fireNewConnection", __FILE__, __LINE__);
    bool retval = false;

    this->listeners.Lock();
    ListenerList::Iterator it = this->listeners.GetIterator();
    while (it.HasNext()) {
        if (it.Next()->OnNewConnection(*this, channel)) {
            retval = true;
            break;
        }
    }
    this->listeners.Unlock();

    VLTRACE(Trace::LEVEL_VL_ANNOYINGLY_VERBOSE, "CommServer informed "
        "listeners about new connection. Was accepted: %s\n", 
        retval ? "yes" : "no");
    return retval;
}
Exemplo n.º 27
0
static fssh_status_t
add_transaction_listener(block_cache* cache, cache_transaction* transaction,
	int32_t events, fssh_transaction_notification_hook hookFunction, void* data)
{
	ListenerList::Iterator iterator = transaction->listeners.GetIterator();
	while (iterator.HasNext()) {
		cache_listener* listener = iterator.Next();

		if (listener->data == data && listener->hook == hookFunction) {
			// this listener already exists, just update it
			listener->events |= events;
			return FSSH_B_OK;
		}
	}

	cache_listener* listener = new(std::nothrow) cache_listener;
	if (listener == NULL)
		return FSSH_B_NO_MEMORY;

	set_notification(transaction, *listener, events, hookFunction, data);
	transaction->listeners.Add(listener);
	return FSSH_B_OK;
}