#include <stdatomic.h>
+#include <spec_lib.h>
+#include <stdlib.h>
+#include <cdsannotate.h>
+#include <specannotation.h>
+#include <model_memory.h>
+#include "common.h"
+
#define MAX_NODES 0xf
typedef unsigned long long pointer;
}
@DefineFunc:
call_id_t get_id(void *wrapper) {
+ if (wrapper == NULL)
+ return 0;
return ((tag_elem_t*) wrapper)->id;
}
@DefineFunc:
/**
@Begin
@Interface: Enqueue
- @Commit_point_set: Enqueue_Success_Point
- @ID: get_and_inc(tag);
+ @Commit_point_set: Enqueue_Read_Tail | Enqueue_UpdateNext | Enqueue_UpdateOrLoad_Tail
+ @ID: get_and_inc(tag)
@Action:
# __ID__ is an internal macro that refers to the id of the current
# interface call
/**
@Begin
@Interface: Dequeue
- @Commit_point_set: Dequeue_Success_Point | Dequeue_Empty_Point
+ @Commit_point_set: Dequeue_Read_Head | Dequeue_Read_Tail | Dequeue_LoadNext
@ID: get_id(front(__queue))
@Action:
- unsigned int _Old_Val = get_data(front(__queue));
- pop_front(__queue);
+ unsigned int _Old_Val = 0;
+ if (size(__queue) > 0) {
+ _Old_Val = get_data(front(__queue));
+ pop_front(__queue);
+ } else {
+ _Old_Val = 0;
+ }
@Post_check:
- _Old_Val == __RET__
+ __RET__ ? *output == _Old_Val : _Old_Val == 0
@End
*/
-unsigned int dequeue(queue_t *q);
+bool dequeue(queue_t *q, int *output);
int get_thread_num();
#endif