Mercurial > hg > Members > yutaka > manager
view ppe/Spe.cc @ 0:68a98d68d62a
commit
author | yutaka@localhost.localdomain |
---|---|
date | Sun, 28 Mar 2010 19:47:00 +0900 |
parents | |
children |
line wrap: on
line source
#include <libspe2.h> #include <pthread.h> void *run_abs_spe(void *arg) { spe_context_ptr_t *spe = (spe_context_ptr_t*) arg; unsigned int entry; spe_stop_info_t stop_info; entry = SPE_DEFAULT_ENTRY; spe_context_run(*spe, &entry, 0, 0, NULL, &stop_info); return NULL; } void spe_run_start(spe_context_ptr_t *spe, spe_program_handle_t *prog, pthread_t *thread, int spe_num) { for (int i = 0; i < spe_num; i++) { spe[i] = spe_context_create(0, NULL); spe_program_load(spe[i], prog); pthread_create(&thread[i], NULL, run_abs_spe, &spe[i]); } } void spe_run_endwait(spe_context_ptr_t *spe, pthread_t *thread, int spe_num) { for (int i = 0; i < spe_num; i++) { pthread_join(thread[i], NULL); spe_context_destroy(spe[i]); } }