Mercurial > hg > Game > Cerium
view TaskManager/kernel/ppe/CpuThreads.h @ 2069:26aa08c9a1de draft default tip
cuda example fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 12 Feb 2017 10:04:55 +0900 |
parents | a68dbdf9b429 |
children |
line wrap: on
line source
#ifndef INCLUDED_CPU_THREADS #define INCLUDED_CPU_THREADS #include <pthread.h> #include "Threads.h" #include "GpuThreads.h" #ifdef __CERIUM_CUDA__ #include "CudaThreads.h" #endif #include "TaskManagerImpl.h" #include "MainScheduler.h" #include "Sem.h" typedef struct cpu_arg { int cpuid; int id_offset; int cpu_num; struct sched_param priority; // should be syncrhonized MainScheduler *scheduler; TaskManagerImpl *manager; SemPtr wait; int useRefDma; } cpu_thread_arg_t; //class GpuThreads; class CpuThreads : public Threads { public: /* constructor */ CpuThreads(int num = 1, int i_num = 0, int useRefDma = 0, int start_id = 0); ~CpuThreads(); static void *cpu_thread_run(void *args); /* functions */ virtual void init(); virtual int get_mail(int speid, int count, memaddr *ret); // BLOCKING virtual int has_mail(int speid, int count, memaddr *ret); // NONBLOCK virtual void send_mail(int speid, int num, memaddr *data); // BLOCKING virtual void add_output_tasklist(int command, memaddr buff, int alloc_size); virtual int is_gpu(int cpuid); virtual int spawn_task(int cpu_num,TaskListPtr p); virtual void set_mail_waiter(SemPtr w); /* variables */ pthread_t *threads; cpu_thread_arg_t *args; SemPtr wait; //スレッド生成時の待ち用 int cpu_num; int io_num; // high priority thread for IO int use_refdma; int id_offset; #ifdef __CERIUM_GPU__ GpuThreads *gpu; #endif #ifdef __CERIUM_CUDA__ CudaThreads *gpu; #endif }; #endif