mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
use fifio queue instead of stack-like queue
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#ifndef KERNEL_H
|
||||
#define KERNEL_H
|
||||
|
||||
#include <util/list.h>
|
||||
#include <util/fifo.h>
|
||||
|
||||
#define GENODE
|
||||
#include "../uos-intel-gpgpu/driver/gpgpu_driver.h"
|
||||
@@ -13,7 +13,7 @@ namespace gpgpu_virt {
|
||||
* @class This class represents a kernel
|
||||
*
|
||||
*/
|
||||
class Kernel : public Genode::List<Kernel>::Element
|
||||
class Kernel : public Genode::Fifo<Kernel>::Element
|
||||
{
|
||||
private:
|
||||
struct kernel_config* kconf;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define VGPU_H
|
||||
|
||||
#include <util/list.h>
|
||||
#include <util/fifo.h>
|
||||
#include "kernel.h"
|
||||
|
||||
// driver
|
||||
@@ -18,7 +19,7 @@ namespace gpgpu_virt {
|
||||
context* ctx;
|
||||
|
||||
/// list of gpgpu tasks for this vpgu
|
||||
Genode::List<Kernel> ready_list;
|
||||
Genode::Fifo<Kernel> ready_list;
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -33,7 +34,8 @@ namespace gpgpu_virt {
|
||||
*/
|
||||
void add_kernel(Kernel* kernel) {
|
||||
kernel->get_config()->ctx = ctx; // set context
|
||||
ready_list.insert(kernel);
|
||||
ready_list.enqueue(*kernel);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +64,7 @@ namespace gpgpu_virt {
|
||||
*/
|
||||
bool has_kernel() const
|
||||
{
|
||||
return ready_list.first() == nullptr;
|
||||
return ready_list.empty() == false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,9 +73,11 @@ namespace gpgpu_virt {
|
||||
* @return First kernel image in ready list
|
||||
*/
|
||||
Kernel* take_kernel() {
|
||||
Kernel* k = ready_list.first();
|
||||
ready_list.remove(k);
|
||||
return k;
|
||||
Kernel* ret = nullptr;
|
||||
ready_list.dequeue([&ret](Kernel& k){
|
||||
ret = &k;
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user