本文整理汇总了C++中BLooper::IsLocked方法的典型用法代码示例。如果您正苦于以下问题:C++ BLooper::IsLocked方法的具体用法?C++ BLooper::IsLocked怎么用?C++ BLooper::IsLocked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLooper
的用法示例。
在下文中一共展示了BLooper::IsLocked方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
BHandler::SetFilterList(BList* filters)
{
BLooper* looper = fLooper;
if (looper != NULL && !looper->IsLocked()) {
debugger("Owning Looper must be locked before calling SetFilterList");
return;
}
/**
@note I would like to use BObjectList internally, but this function is
spec'd such that fFilters would get deleted and then assigned
'filters', which would obviously mess this up. Wondering if
anyone ever assigns a list of filters and then checks against
FilterList() to see if they are the same.
*/
// TODO: Explore issues with using BObjectList
if (fFilters != NULL) {
fFilters->DoForEach(FilterDeleter);
delete fFilters;
}
fFilters = filters;
if (fFilters) {
for (int32 i = 0; i < fFilters->CountItems(); ++i) {
BMessageFilter* filter =
static_cast<BMessageFilter*>(fFilters->ItemAt(i));
if (filter != NULL)
filter->SetLooper(looper);
}
}
}
示例2: notify
status_t ObservableHandler::notify(
BMessage* message) {
#if DEBUG
BLooper* l = Looper();
ASSERT(l);
ASSERT(l->IsLocked());
#endif
return Invoke(message);
}
示例3: Archive
status_t ObservableHandler::Archive(
BMessage* archive,
bool deep) const {
#if DEBUG
BLooper* l = Looper();
ASSERT(l);
ASSERT(l->IsLocked());
#endif
if(m_released)
return B_NOT_ALLOWED; // can't archive a dead object
return _inherited::Archive(archive, deep);
}
示例4: _handleAddObserver
void ObservableHandler::_handleAddObserver(
BMessage* message) {
#if DEBUG
BLooper* l = Looper();
ASSERT(l);
ASSERT(l->IsLocked());
#endif
BMessage reply;
BMessenger observer;
status_t err = message->FindMessenger(
"observer", &observer);
if(err < B_OK) {
PRINT((
"* ObservableHandler::_handleAddObserver(): no observer specified!\n"));
// send reply? +++++
return;
}
if(m_released) {
// already quitting
reply.what = M_BAD_TARGET;
reply.AddMessenger("target", BMessenger(this));
reply.AddMessenger("observer", observer);
message->SendReply(&reply);
return;
}
else if(IndexOfTarget(observer.Target(0)) != -1) {
// observer already added
reply.what = M_BAD_OBSERVER;
reply.AddMessenger("target", BMessenger(this));
reply.AddMessenger("observer", observer);
message->SendReply(&reply);
return;
}
// valid observer given
// add it
err = AddTarget(observer.Target(0));
ASSERT(err == B_OK);
// call hook
observerAdded(observer);
}
示例5: _handleRemoveObserver
void ObservableHandler::_handleRemoveObserver(
BMessage* message) {
#if DEBUG
BLooper* l = Looper();
ASSERT(l);
ASSERT(l->IsLocked());
#endif
BMessage reply;
BMessenger observer;
status_t err = message->FindMessenger(
"observer", &observer);
if(err < B_OK) {
PRINT((
"* ObservableHandler::_handleRemoveObserver(): no observer specified!\n"));
// send reply? +++++
return;
}
int32 index = IndexOfTarget(observer.Target(0));
if(index == -1) {
reply.what = M_BAD_OBSERVER;
reply.AddMessenger("target", BMessenger(this));
reply.AddMessenger("observer", observer);
message->SendReply(&reply);
return;
}
// valid observer given; remove it & call notification hook
RemoveTarget(index);
observerRemoved(observer);
// time to shut down?
if(m_released && !CountTargets()) {
releaseComplete();
delete this; // BOOM!
}
}