예제 #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);
}
예제 #2
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
void
Team::_NotifyTeamRenamed()
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->TeamRenamed(Event(TEAM_EVENT_TEAM_RENAMED, this));
	}
}
예제 #3
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
void
Team::_NotifyThreadRemoved(Thread* thread)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->ThreadRemoved(ThreadEvent(TEAM_EVENT_THREAD_REMOVED, thread));
	}
}
예제 #4
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
void
Team::_NotifyImageRemoved(Image* image)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->ImageRemoved(ImageEvent(TEAM_EVENT_IMAGE_REMOVED, image));
	}
}
예제 #5
0
void
TeamsWindow::_NotifySelectedInterfaceChanged(TargetHostInterface* interface)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->SelectedInterfaceChanged(interface);
	}
}
예제 #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();
}
예제 #7
0
void
StackFrame::NotifyValueRetrieved(Variable* variable, TypeComponentPath* path)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->StackFrameValueRetrieved(this, variable, path);
	}
}
예제 #8
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #9
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #10
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #11
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #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();
}
예제 #13
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #14
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #15
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #16
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #17
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
void
Team::NotifyWatchpointChanged(Watchpoint* watchpoint)
{
	for (ListenerList::Iterator it = fListeners.GetIterator();
			Listener* listener = it.Next();) {
		listener->WatchpointChanged(WatchpointEvent(
			TEAM_EVENT_WATCHPOINT_CHANGED, this, watchpoint));
	}
}
예제 #18
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #19
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #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);
	}
}
예제 #21
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #22
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #23
0
파일: Team.cpp 프로젝트: AmirAbrams/haiku
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));
	}
}
예제 #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;
}
예제 #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;
}
예제 #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;
}
예제 #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;
}