view TaskManager/kernel/ppe/Threads.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 f73ca57cdc81
children
line wrap: on
line source

#ifndef INCLUDED_THREADS
#define INCLUDED_THREADS

#include <pthread.h>
#include "base.h"
#include "types.h"
#include "TaskList.h"

class Sem;

class Threads {
public:
    BASE_NEW_DELETE(Threads);

    /* constructor */
    Threads(int num = 1) {};
    virtual ~Threads() {};

    /* functions */
    virtual void init() = 0;
    virtual int get_mail(int speid, int count, memaddr *ret) = 0; // BLOCKING
    virtual int has_mail(int speid, int count, memaddr *ret) = 0; // NONBLOCK
    virtual void send_mail(int speid, int num, memaddr *data) = 0; // BLOCKING
    virtual void add_output_tasklist(int command, memaddr buff, int alloc_size) = 0;
    virtual int is_gpu(int cpuid) { return 0; }
    virtual int spawn_task(int cpu_num, TaskListPtr p) = 0;
    virtual void set_mail_waiter(Sem *w) = 0;
    /* variables */
    pthread_t *threads;
    int cpu_num;
}  ;

#endif