本文整理汇总了C++中JavaVM::AttachCurrentThreadAsDaemon方法的典型用法代码示例。如果您正苦于以下问题:C++ JavaVM::AttachCurrentThreadAsDaemon方法的具体用法?C++ JavaVM::AttachCurrentThreadAsDaemon怎么用?C++ JavaVM::AttachCurrentThreadAsDaemon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JavaVM
的用法示例。
在下文中一共展示了JavaVM::AttachCurrentThreadAsDaemon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static void
SystemActivityNotifications_notify(jint type)
{
jobject delegate = SystemActivityNotifications_delegate;
if (delegate)
{
JavaVM *vm = SystemActivityNotifications_vm;
if (vm)
{
JNIEnv *env;
if (0 == vm->AttachCurrentThreadAsDaemon((void **) &env, NULL))
{
jclass clazz = env->GetObjectClass(delegate);
if (clazz)
{
jmethodID methodID
= env->GetMethodID(clazz,"notify", "(I)V");
if (methodID)
env->CallVoidMethod(delegate, methodID, type);
}
env->ExceptionClear();
}
}
}
}
开发者ID:LMVUH,项目名称:jitsi-110915,代码行数:30,代码来源:net_java_sip_communicator_impl_sysactivity_SystemActivityNotifications.cpp
示例2: env
Jvm::Env::Env(bool daemon)
: env(NULL), detach(false)
{
JavaVM* jvm = Jvm::get()->jvm;
// First check if we are already attached.
int result = jvm->GetEnv(JNIENV_CAST(&env), Jvm::get()->version);
// If we're not attached, attach now.
if (result == JNI_EDETACHED) {
if (daemon) {
jvm->AttachCurrentThreadAsDaemon(JNIENV_CAST(&env), NULL);
} else {
jvm->AttachCurrentThread(JNIENV_CAST(&env), NULL);
}
detach = true;
}
}