#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <time.h>
#include <unistd.h>
#include <uv.h>
Go to the source code of this file.
◆ ARRAY_SIZE
◆ DELETE_LOOP_SLEEP_TIME
| #define DELETE_LOOP_SLEEP_TIME 5000 |
This file is a demo for how object_maintainence.c would work.
The idea here is:
- There are two arrays: 1. HASHMAP_DRAM and
- HASHMAP_NVRAM
- There are two loops: 1. Logistics loop (for moving objects) runs every MOVE_LOOP_SLEEP_TIME secs
- Deletion loop (for deleting objects) runs every DELETE_LOOP_SLEEP_TIME secs
- There is one more thread,
thread_maintainer, which is required to run the two loops
- There
main thread prints out the array
Definition at line 23 of file uv_loop_demo_example.c.
◆ MAIN_LOOP_SLEEP_TIME
| #define MAIN_LOOP_SLEEP_TIME 10000 |
◆ MOVE_LOOP_SLEEP_TIME
| #define MOVE_LOOP_SLEEP_TIME 5000 |
◆ array_initialise()
| void array_initialise |
( |
| ) |
|
◆ delete_from_dram()
| void delete_from_dram |
( |
uv_work_t * |
req | ) |
|
◆ delete_from_nvram()
| void delete_from_nvram |
( |
uv_work_t * |
req | ) |
|
◆ deletion_thread_function()
| void* deletion_thread_function |
( |
void * |
data | ) |
|
◆ logistics_thread_function()
| void* logistics_thread_function |
( |
void * |
data | ) |
|
◆ main()
◆ move_from_dram()
| void move_from_dram |
( |
uv_work_t * |
req | ) |
|
◆ move_from_nvram()
| void move_from_nvram |
( |
uv_work_t * |
req | ) |
|
◆ on_after_work()
| void on_after_work |
( |
uv_work_t * |
req, |
|
|
int |
status |
|
) |
| |
◆ on_deletion_timer()
| void on_deletion_timer |
( |
uv_timer_t * |
timer, |
|
|
int |
status |
|
) |
| |
◆ on_logistics_timer()
| void on_logistics_timer |
( |
uv_timer_t * |
timer, |
|
|
int |
status |
|
) |
| |
◆ print_array()
| void print_array |
( |
int |
arr[], |
|
|
int |
size, |
|
|
char * |
msg |
|
) |
| |
◆ dram_mutex
◆ HASHMAP_DRAM
◆ HASHMAP_NVRAM
◆ nvram_mutex