#ifndef FRES_VRES_H
#define FRES_VRES_H
+#include <fosa.h>
+
#include <fres_contract_idl.h>
#include <ul_gavlcust.h>
typedef struct fres_vres {
/** Contracts IDs of this VRES. */
fres_contract_id_t id;
-
+
/**
* Stores actual allocation of the resource. During a mode
* change, the callbacks can compare this old allocation with
- * the changed (stored in @a new) one and depending on the
- * kind of difference, it can apply the change
+ * the changed one (stored in @a new) and depending on the
+ * kind of difference, they can apply the change
* differently. Callbacks must not change this field. as well as
* the @a perceived field.
*/
/**
* The schedulable contract received by the allocator. The
- * shceduler callback should use this contract to
+ * allocator callbacks should use this contract to
* create/change VRES and must not change the value of this
* field.
*/
struct fres_contract *new;
-
+
struct fres_allocator *allocator;
void *priv; /**< Resource allocator private data */
gavl_node_t node;
fres_vres_t *fres_vres_new(fres_contract_id_t *id);
void fres_vres_destroy(fres_vres_t *vres);
+/**
+ * Representation of thread to VRES binding.
+ */
+typedef struct fres_thread_vres {
+ fosa_thread_id_t id;
+ fres_vres_t *vres;
+
+ fosa_abs_time_t job_start_time;
+ fosa_abs_time_t job_cpu_time;
+
+ gavl_node_t node;
+} fres_thread_vres_t;
+
+static inline
+int fres_thread_vres_cmp(const fosa_thread_id_t *a, const fosa_thread_id_t *b)
+{
+ return fosa_thread_equal(*a, *b);
+}
+
+fres_thread_vres_t *fres_thread_vres_new
+ (const fosa_thread_id_t *id,
+ fres_vres_t *vres);
+
+void fres_thread_vres_destroy(fres_thread_vres_t *th_vres);
#endif