forked from haiwan/sledge
parent
34d91cfa21
commit
6eb5825b55
@ -1,10 +0,0 @@
|
|||||||
#ifndef SFRT_SANDBOX_REQUEST_QUEUE_H
|
|
||||||
#define SFRT_SANDBOX_REQUEST_QUEUE_H
|
|
||||||
|
|
||||||
#include <sandbox_request.h>
|
|
||||||
|
|
||||||
void sandbox_request_queue_initialize(void);
|
|
||||||
int sandbox_request_queue_add(sandbox_request_t *);
|
|
||||||
sandbox_request_t *sandbox_request_queue_remove(void);
|
|
||||||
|
|
||||||
#endif /* SFRT_SANDBOX_REQUEST_QUEUE_H */
|
|
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef SFRT_SANDBOX_REQUEST_SCHEDULER_H
|
||||||
|
#define SFRT_SANDBOX_REQUEST_SCHEDULER_H
|
||||||
|
|
||||||
|
#include <sandbox_request.h>
|
||||||
|
|
||||||
|
// Returns pointer back if successful, null otherwise
|
||||||
|
typedef sandbox_request_t *(*sandbox_request_scheduler_add_t)(void *);
|
||||||
|
typedef sandbox_request_t *(*sandbox_request_scheduler_remove_t)(void);
|
||||||
|
|
||||||
|
typedef struct sandbox_request_scheduler_config_t {
|
||||||
|
sandbox_request_scheduler_add_t add;
|
||||||
|
sandbox_request_scheduler_remove_t remove;
|
||||||
|
} sandbox_request_scheduler_config_t;
|
||||||
|
|
||||||
|
|
||||||
|
void sandbox_request_scheduler_initialize(sandbox_request_scheduler_config_t *config);
|
||||||
|
|
||||||
|
sandbox_request_t *sandbox_request_scheduler_add(sandbox_request_t *);
|
||||||
|
sandbox_request_t *sandbox_request_scheduler_remove();
|
||||||
|
|
||||||
|
#endif /* SFRT_SANDBOX_REQUEST_QUEUE_H */
|
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef SFRT_SANDBOX_REQUEST_SCHEDULER_FIFO_H
|
||||||
|
#define SFRT_SANDBOX_REQUEST_SCHEDULER_FIFO_H
|
||||||
|
|
||||||
|
#include <sandbox_request_scheduler.h>
|
||||||
|
|
||||||
|
void sandbox_request_scheduler_fifo_initialize();
|
||||||
|
|
||||||
|
#endif /* SFRT_SANDBOX_REQUEST_QUEUE_H */
|
@ -0,0 +1,28 @@
|
|||||||
|
#include <sandbox_request_scheduler.h>
|
||||||
|
|
||||||
|
|
||||||
|
// The global of our polymorphic interface
|
||||||
|
sandbox_request_scheduler_config_t sandbox_request_scheduler;
|
||||||
|
|
||||||
|
// Initializes a concrete implementation of the sandbox request scheduler interface
|
||||||
|
void
|
||||||
|
sandbox_request_scheduler_initialize(sandbox_request_scheduler_config_t *config)
|
||||||
|
{
|
||||||
|
memcpy(&sandbox_request_scheduler, config, sizeof(sandbox_request_scheduler_config_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds a sandbox request
|
||||||
|
sandbox_request_t *
|
||||||
|
sandbox_request_scheduler_add(sandbox_request_t *sandbox_request)
|
||||||
|
{
|
||||||
|
assert(sandbox_request_scheduler.add != NULL);
|
||||||
|
return sandbox_request_scheduler.add(sandbox_request);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Removes a sandbox request
|
||||||
|
sandbox_request_t *
|
||||||
|
sandbox_request_scheduler_remove()
|
||||||
|
{
|
||||||
|
assert(sandbox_request_scheduler.remove != NULL);
|
||||||
|
return sandbox_request_scheduler.remove();
|
||||||
|
}
|
Loading…
Reference in new issue