这篇教程C++ thread_resume函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中thread_resume函数的典型用法代码示例。如果您正苦于以下问题:C++ thread_resume函数的具体用法?C++ thread_resume怎么用?C++ thread_resume使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了thread_resume函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mutex_testint mutex_test(void){ static mutex_t imutex = MUTEX_INITIAL_VALUE(imutex); printf("preinitialized mutex:/n"); hexdump(&imutex, sizeof(imutex)); mutex_t m; mutex_init(&m); thread_t *threads[5]; for (uint i=0; i < countof(threads); i++) { threads[i] = thread_create("mutex tester", &mutex_thread, &m, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE); thread_resume(threads[i]); } for (uint i=0; i < countof(threads); i++) { thread_join(threads[i], NULL, INFINITE_TIME); } printf("done with simple mutex tests/n"); printf("testing mutex timeout/n"); mutex_t timeout_mutex; mutex_init(&timeout_mutex); mutex_acquire(&timeout_mutex); for (uint i=0; i < 2; i++) { threads[i] = thread_create("mutex timeout tester", &mutex_timeout_thread, (void *)&timeout_mutex, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE); thread_resume(threads[i]); } for (uint i=2; i < 4; i++) { threads[i] = thread_create("mutex timeout tester", &mutex_zerotimeout_thread, (void *)&timeout_mutex, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE); thread_resume(threads[i]); } thread_sleep(5000); mutex_release(&timeout_mutex); for (uint i=0; i < 4; i++) { thread_join(threads[i], NULL, INFINITE_TIME); } printf("done with mutex tests/n"); mutex_destroy(&timeout_mutex); return 0;}
开发者ID:dzc1234ok,项目名称:lk,代码行数:52,
示例2: quantum_testvoid quantum_test(void){ thread_resume(thread_create ("quantum tester 0", &quantum_tester, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE)); thread_resume(thread_create ("quantum tester 1", &quantum_tester, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE)); thread_resume(thread_create ("quantum tester 2", &quantum_tester, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE)); thread_resume(thread_create ("quantum tester 3", &quantum_tester, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE));}
开发者ID:astarasikov,项目名称:lk-msm7200a-htc-wince,代码行数:15,
示例3: port_deallocateQTSSvrControlThread::~QTSSvrControlThread(){ fDone = true; port_deallocate(task_self(), fMessagePort);//force SC thread to wakeup fMessagePort = 0; //wait for thread to terminate... these mach prototypes are very strange... //why, for instance, does thread_resume take an INT???? if (fThreadsAllocated) { thread_resume((unsigned int)fThreadID);//force a wakeup. cthread_join(fThreadID); thread_resume((unsigned int)fHistoryThreadID); cthread_join(fHistoryThreadID); }}
开发者ID:248668342,项目名称:ffmpeg-windows,代码行数:15,
示例4: boot_script_exec_cmdintboot_script_exec_cmd (void *hook, task_t task, char *path, int argc, char **argv, char *strings, int stringlen){ struct multiboot_module *mod = hook; int err; if (task != MACH_PORT_NULL) { thread_t thread; struct user_bootstrap_info info = { mod, argv, 0, }; simple_lock_init (&info.lock); simple_lock (&info.lock); err = thread_create ((task_t)task, &thread); assert(err == 0); thread->saved.other = &info; thread_start (thread, user_bootstrap); thread_resume (thread); /* We need to synchronize with the new thread and block this main thread until it has finished referring to our local state. */ while (! info.done) { thread_sleep ((event_t) &info, simple_lock_addr(info.lock), FALSE); simple_lock (&info.lock); } printf ("/n"); } return 0;}
开发者ID:sebastianscatularo,项目名称:gnumach,代码行数:33,
示例5: module_loadstatic void module_load(multiboot_tag_t *tag){ /* calculate size and phy32 pointer */ size_t size = tag->module.mod_end - tag->module.mod_start; elf64_ehdr_t *elf = (elf64_ehdr_t *) aphy32_to_virt(tag->module.mod_start); /* make a new process */ proc_t *proc = proc_create(); if (!proc) panic("couldn't create process for module"); /* switch our address space */ proc_switch(proc); /* load the ELF file */ if (!elf64_load(elf, size)) panic("couldn't load elf64 file"); /* make a new thread */ thread_t *thread = thread_create(proc, 0); if (!thread) panic("couldn't create thread for module"); /* set entry point of the thread */ thread->rip = elf->e_entry; /* add thread to the scheduler's ready queue */ thread_resume(thread);}
开发者ID:grahamedgecombe,项目名称:arc,代码行数:29,
示例6: bsd_utaskbootstrapvoidbsd_utaskbootstrap(void){ thread_t thread; struct uthread *ut; /* * Clone the bootstrap process from the kernel process, without * inheriting either task characteristics or memory from the kernel; */ thread = cloneproc(TASK_NULL, kernproc, FALSE); /* Hold the reference as it will be dropped during shutdown */ initproc = proc_find(1); #if __PROC_INTERNAL_DEBUG if (initproc == PROC_NULL) panic("bsd_utaskbootstrap: initproc not set/n");#endif /* * Since we aren't going back out the normal way to our parent, * we have to drop the transition locks explicitly. */ proc_signalend(initproc, 0); proc_transend(initproc, 0); ut = (struct uthread *)get_bsdthread_info(thread); ut->uu_sigmask = 0; act_set_astbsd(thread); (void) thread_resume(thread);}
开发者ID:Prajna,项目名称:xnu,代码行数:30,
示例7: sgen_thread_handshake/* LOCKING: assumes the GC lock is held */intsgen_thread_handshake (BOOL suspend){ SgenThreadInfo *cur_thread = mono_thread_info_current (); kern_return_t ret; SgenThreadInfo *info; int count = 0; FOREACH_THREAD_SAFE (info) { if (info == cur_thread || sgen_is_worker_thread (mono_thread_info_get_tid (info))) continue; if (info->gc_disabled) continue; if (suspend) { if (!sgen_suspend_thread (info)) continue; } else { ret = thread_resume (info->info.native_handle); if (ret != KERN_SUCCESS) continue; } count ++; } END_FOREACH_THREAD_SAFE return count;}
开发者ID:Adamcbrz,项目名称:mono,代码行数:28,
示例8: resume_threadint resume_thread(unsigned int thread){ int i; kern_return_t ret; unsigned int size = THREAD_BASIC_INFO_COUNT; struct thread_basic_info info; ret = thread_info(thread, THREAD_BASIC_INFO, (thread_info_t) &info, &size); if(ret != KERN_SUCCESS) { fprintf(stderr, "Failed to get thread info 1, got %d/n", ret); // return ok for the case when the process is going away return -1; return 0; } for(i = 0; i < info.suspend_count; i++) { ret = thread_resume(thread); if(ret != KERN_SUCCESS) { fprintf(stderr, "Failed to get thread info 2, got %d/n", ret); return -1; } } return 0;}
开发者ID:reeth,项目名称:pydbg64,代码行数:29,
示例9: _thread_cond_signalstatic int _thread_cond_signal(cond_t *cond, int broadcast){ /* consistency checks */ if (cond == NULL) return_errno(FALSE, EINVAL); if (!(cond->cn_state & THREAD_COND_INITIALIZED)) return_errno(FALSE, EDEADLK); // do something only if there is at least one waiters (POSIX semantics) if (cond->cn_waiters > 0) { // signal the condition do { thread_t *t = dequeue(&cond->wait_queue); assert (t != NULL); thread_resume(t); // t could also be a timed out thread, but it doesn't matter cond->cn_waiters--; } while (broadcast && !queue_isempty(&cond->wait_queue)); // and give other threads a chance to grab the CPU CAP_SET_SYSCALL(); thread_yield(); CAP_CLEAR_SYSCALL(); } /* return to caller */ return TRUE;}
开发者ID:bernied,项目名称:capriccio,代码行数:27,
示例10: thread_alloc_and_runstatic void thread_alloc_and_run(struct thread_smc_args *args){ size_t n; struct thread_core_local *l = get_core_local(); bool found_thread = false; assert(l->curr_thread == -1); lock_global(); if (!have_one_active_thread() && !have_one_preempted_thread()) { for (n = 0; n < NUM_THREADS; n++) { if (threads[n].state == THREAD_STATE_FREE) { threads[n].state = THREAD_STATE_ACTIVE; found_thread = true; break; } } } unlock_global(); if (!found_thread) { args->a0 = TEESMC_RETURN_EBUSY; args->a1 = 0; args->a2 = 0; args->a3 = 0; return; } l->curr_thread = n; threads[n].regs.pc = (uint32_t)thread_stdcall_entry; /* Stdcalls starts in SVC mode with masked IRQ and unmasked FIQ */ threads[n].regs.cpsr = CPSR_MODE_SVC | CPSR_I; threads[n].flags = 0; /* Enable thumb mode if it's a thumb instruction */ if (threads[n].regs.pc & 1) threads[n].regs.cpsr |= CPSR_T; /* Reinitialize stack pointer */ threads[n].regs.svc_sp = threads[n].stack_va_end; /* * Copy arguments into context. This will make the * arguments appear in r0-r7 when thread is started. */ threads[n].regs.r0 = args->a0; threads[n].regs.r1 = args->a1; threads[n].regs.r2 = args->a2; threads[n].regs.r3 = args->a3; threads[n].regs.r4 = args->a4; threads[n].regs.r5 = args->a5; threads[n].regs.r6 = args->a6; threads[n].regs.r7 = args->a7; /* Save Hypervisor Client ID */ threads[n].hyp_clnt_id = args->a7; thread_resume(&threads[n].regs);}
开发者ID:gxliu,项目名称:optee_os,代码行数:60,
示例11: thread_2/* * Thread 2 - Priority = 101 */static voidthread_2(void){ int error; printf("thread_2: starting/n"); /* * 1) Lock mutex A */ printf("thread_2: 1) lock A/n"); error = mutex_lock(&mtx_A); if (error) printf("error=%d/n", error); /* * Switch to thread 1 */ thread_resume(th_1); printf("thread_2: running/n"); /* * 4) Lock mutex B * * Deadlock occurs here! */ printf("thread_2: 4) lock B/n"); error = mutex_lock(&mtx_B); if (error) printf("error=%d/n", error); if (error == EDEADLK) printf("**** DEADLOCK!! ****/n"); printf("thread_2: exit/n"); thread_terminate(th_2);}
开发者ID:AdamRLukaitis,项目名称:prex,代码行数:37,
示例12: gdb_pthread_killvoidgdb_pthread_kill(pthread_t pthread){ mach_port_t mthread; kern_return_t kret; int ret; mthread = pthread_mach_thread_np(pthread); kret = thread_suspend(mthread); MACH_CHECK_ERROR(kret); ret = pthread_cancel(pthread); if (ret != 0) {/* in case a macro has re-defined this function: */#undef strerror warning("Unable to cancel thread: %s (%d)", strerror(errno), errno); thread_terminate(mthread); } kret = thread_abort (mthread); MACH_CHECK_ERROR (kret); kret = thread_resume (mthread); MACH_CHECK_ERROR (kret); ret = pthread_join (pthread, NULL); if (ret != 0) { warning ("Unable to join to canceled thread: %s (%d)", strerror (errno), errno); }}
开发者ID:dougmencken,项目名称:apple-gdb-1824,代码行数:34,
示例13: sgen_thread_handshake/* LOCKING: assumes the GC lock is held */intsgen_thread_handshake (BOOL suspend){ SgenThreadInfo *cur_thread = mono_thread_info_current (); kern_return_t ret; int count = 0; cur_thread->client_info.suspend_done = TRUE; FOREACH_THREAD (info) { if (info == cur_thread || sgen_thread_pool_is_thread_pool_thread (mono_thread_info_get_tid (info))) continue; info->client_info.suspend_done = FALSE; if (info->client_info.gc_disabled) continue; if (suspend) { if (!sgen_suspend_thread (info)) continue; } else { do { ret = thread_resume (info->client_info.info.native_handle); } while (ret == KERN_ABORTED); if (ret != KERN_SUCCESS) continue; } count ++; } FOREACH_THREAD_END return count;}
开发者ID:0ostreamo0,项目名称:mono,代码行数:32,
示例14: ThreadPThread__SuspendThreadint__cdeclThreadPThread__SuspendThread (m3_pthread_t mt){ kern_return_t status = { 0 }; mach_port_t mach_thread = PTHREAD_FROM_M3(mt); status = thread_suspend(mach_thread); if (status != KERN_SUCCESS) { fprintf(stderr, "thread_suspend returned %d instead of %d/n", (int)status, (int)KERN_SUCCESS); return 0; } status = thread_abort_safely(mach_thread); if (status != KERN_SUCCESS) { fprintf(stderr, "thread_abort_safely returned %d instead of %d/n", (int)status, (int)KERN_SUCCESS); status = thread_resume(mach_thread); if (status != KERN_SUCCESS) { fprintf(stderr, "thread_resume returned %d instead of %d/n", (int)status, (int)KERN_SUCCESS); abort(); } return 0; } return 1;}
开发者ID:RodneyBates,项目名称:M3Devel,代码行数:29,
示例15: mono_threads_core_abort_syscallvoidmono_threads_core_abort_syscall (MonoThreadInfo *info){ kern_return_t ret; do { ret = thread_suspend (info->native_handle); } while (ret == KERN_ABORTED); if (ret != KERN_SUCCESS) return; do { ret = thread_abort_safely (info->native_handle); } while (ret == KERN_ABORTED); /* * We are doing thread_abort when thread_abort_safely returns KERN_SUCCESS because * for some reason accept is not interrupted by thread_abort_safely. * The risk of aborting non-atomic operations while calling thread_abort should not * exist because by the time thread_abort_safely returns KERN_SUCCESS the target * thread should have return from the kernel and should be waiting for thread_resume * to resume the user code. */ if (ret == KERN_SUCCESS) ret = thread_abort (info->native_handle); do { ret = thread_resume (info->native_handle); } while (ret == KERN_ABORTED); g_assert (ret == KERN_SUCCESS);}
开发者ID:0ostreamo0,项目名称:mono,代码行数:33,
示例16: download_exint download_ex(u32 data_length)//Big image and parallel transfer.{ thread_t *thr; init_engine_context(&ctx); init_sto_info(&sto_info, FALSE); //no checksum enabled. sto_info.to_write_data_len = data_length; thr = thread_create("fastboot", write_storage_proc, 0, DEFAULT_PRIORITY, 16*1024); if (!thr) { return -1; } thread_resume(thr); TIME_START; read_usb_proc(&data_length); //wait for write thread end. event_wait(&ctx.thr_end_ev); destroy_engine(&ctx); if(ctx.b_error) { fastboot_fail_wrapper("/[email C++ thread_rwlock_unlock函数代码示例 C++ thread_register_notifier函数代码示例
|