@@ -58,7 +58,7 @@ typedef struct _ScheduleCB
58
58
void * arg ;
59
59
size_t pos ;
60
60
struct timeval timeStep ;
61
- pqueue_t * queue ;
61
+ ps_pqueue_t * queue ;
62
62
uint32_t count ;
63
63
char breakpoint ;
64
64
char name [128 ];
@@ -108,7 +108,7 @@ struct EventState
108
108
int hashSize ; // The hash size of the event handler
109
109
int keepGoing ; // Whether the handler should loop or not
110
110
struct GPIOInterruptDesc gpio_intrs [2 ]; // GPIO interrupt state
111
- pqueue_t * queue , * dbg_queue ; // The schedule queue
111
+ ps_pqueue_t * queue , * dbg_queue ; // The schedule queue
112
112
struct EventTimer * evt_timer ;
113
113
char custom_timer ;
114
114
enum EVTDebuggerState initialDebuggerState ;
@@ -300,14 +300,14 @@ struct EventState *EVT_initWithSize(int hashSize, EVT_debug_state_cb debug_cb,
300
300
for (i = 0 ; i < res -> hashSize ; i ++ )
301
301
res -> events [i ] = NULL ;
302
302
303
- res -> queue = pqueue_init (hashSize , cmp_pri , get_pri , set_pri ,
303
+ res -> queue = ps_pqueue_init (hashSize , cmp_pri , get_pri , set_pri ,
304
304
get_pos , set_pos );
305
305
if (res -> queue == NULL ){
306
306
free (res );
307
307
return NULL ;
308
308
}
309
309
310
- res -> dbg_queue = pqueue_init (hashSize , cmp_pri , get_pri , set_pri ,
310
+ res -> dbg_queue = ps_pqueue_init (hashSize , cmp_pri , get_pri , set_pri ,
311
311
get_pos , set_pos );
312
312
if (res -> dbg_queue == NULL ){
313
313
free (res -> queue );
@@ -442,22 +442,22 @@ void EVT_free_handler(EVTHandler *ctx)
442
442
}
443
443
}
444
444
445
- while ((curProc = pqueue_peek (ctx -> queue ))) {
446
- pqueue_pop (ctx -> queue );
445
+ while ((curProc = ps_pqueue_peek (ctx -> queue ))) {
446
+ ps_pqueue_pop (ctx -> queue );
447
447
// Call the callback and see if it wants to be kept
448
448
if (curProc != & ctx -> null_evt )
449
449
free (curProc );
450
450
}
451
451
452
- while ((curProc = pqueue_peek (ctx -> dbg_queue ))) {
453
- pqueue_pop (ctx -> dbg_queue );
452
+ while ((curProc = ps_pqueue_peek (ctx -> dbg_queue ))) {
453
+ ps_pqueue_pop (ctx -> dbg_queue );
454
454
// Call the callback and see if it wants to be kept
455
455
if (curProc != & ctx -> null_evt )
456
456
free (curProc );
457
457
}
458
458
459
- pqueue_free (ctx -> queue );
460
- pqueue_free (ctx -> dbg_queue );
459
+ ps_pqueue_free (ctx -> queue );
460
+ ps_pqueue_free (ctx -> dbg_queue );
461
461
free (ctx );
462
462
}
463
463
@@ -695,7 +695,7 @@ static int evt_process_timed_event(EVTHandler *ctx,
695
695
curProc -> scheduleTime = curTime ;
696
696
timeradd (& curProc -> nextAwake ,
697
697
& curProc -> timeStep , & curProc -> nextAwake );
698
- pqueue_insert (curProc -> queue , curProc );
698
+ ps_pqueue_insert (curProc -> queue , curProc );
699
699
} else {
700
700
if (curProc != & ctx -> null_evt ) {
701
701
free (curProc );
@@ -821,13 +821,13 @@ char EVT_start_loop(EVTHandler *ctx)
821
821
args .maxFd = ctx -> maxFd + 1 ;
822
822
args .mono_to = NULL ;
823
823
824
- curProc = pqueue_peek (ctx -> queue );
824
+ curProc = ps_pqueue_peek (ctx -> queue );
825
825
if (!time_paused && curProc )
826
826
nextAwake = & curProc -> nextAwake ;
827
827
else
828
828
nextAwake = NULL ;
829
829
830
- curProc = pqueue_peek (ctx -> dbg_queue );
830
+ curProc = ps_pqueue_peek (ctx -> dbg_queue );
831
831
if (curProc )
832
832
args .mono_to = & curProc -> nextAwake ;
833
833
@@ -836,29 +836,29 @@ char EVT_start_loop(EVTHandler *ctx)
836
836
& select_event_loop_cb , & args );
837
837
838
838
// Process Timed Events
839
- while (!time_paused && (curProc = pqueue_peek (ctx -> queue ))) {
839
+ while (!time_paused && (curProc = ps_pqueue_peek (ctx -> queue ))) {
840
840
ctx -> evt_timer -> get_monotonic_time (ctx -> evt_timer , & curTime );
841
841
842
842
if (timercmp (& curProc -> nextAwake , & curTime , > )) {
843
843
// Event is not yet ready
844
844
break ;
845
845
}
846
- pqueue_pop (ctx -> queue );
846
+ ps_pqueue_pop (ctx -> queue );
847
847
curProc -> pos = SIZE_MAX ;
848
848
if (!evt_process_timed_event (ctx , curProc , curTime , 0 ))
849
849
goto next_loop_iteration ;
850
850
real_event = 1 ;
851
851
}
852
852
853
- while ((curProc = pqueue_peek (ctx -> dbg_queue ))) {
853
+ while ((curProc = ps_pqueue_peek (ctx -> dbg_queue ))) {
854
854
ET_default_monotonic (NULL , & curTime );
855
855
856
856
if (timercmp (& curProc -> nextAwake , & curTime , > )) {
857
857
// Event is not yet ready
858
858
break ;
859
859
}
860
860
curProc -> pos = SIZE_MAX ;
861
- pqueue_pop (ctx -> dbg_queue );
861
+ ps_pqueue_pop (ctx -> dbg_queue );
862
862
evt_process_timed_event (ctx , curProc , curTime , 1 );
863
863
}
864
864
@@ -952,7 +952,7 @@ void *EVT_sched_add(EVTHandler *handler, struct timeval time,
952
952
newSchedCB -> breakpoint = 0 ;
953
953
newSchedCB -> count = 0 ;
954
954
955
- if (0 == pqueue_insert (newSchedCB -> queue , newSchedCB )){
955
+ if (0 == ps_pqueue_insert (newSchedCB -> queue , newSchedCB )){
956
956
return newSchedCB ;
957
957
}
958
958
@@ -990,7 +990,7 @@ void *EVT_sched_add_with_timestep(EVTHandler *handler, struct timeval time,
990
990
newSchedCB -> name [0 ] = 0 ;
991
991
newSchedCB -> breakpoint = 0 ;
992
992
993
- if (0 == pqueue_insert (newSchedCB -> queue , newSchedCB )){
993
+ if (0 == ps_pqueue_insert (newSchedCB -> queue , newSchedCB )){
994
994
return newSchedCB ;
995
995
}
996
996
@@ -1021,7 +1021,7 @@ void *EVT_sched_remove(EVTHandler *handler, void *eventId)
1021
1021
if (evt != & handler -> null_evt )
1022
1022
free (evt );
1023
1023
}
1024
- else if (0 == pqueue_remove (evt -> queue , eventId )) {
1024
+ else if (0 == ps_pqueue_remove (evt -> queue , eventId )) {
1025
1025
evt -> pos = SIZE_MAX ;
1026
1026
result = evt -> arg ;
1027
1027
if (evt != & handler -> null_evt )
@@ -1057,7 +1057,7 @@ char EVT_sched_update(EVTHandler *handler, void *eventId, struct timeval time)
1057
1057
1058
1058
timeradd (& evt -> scheduleTime , & time , & evt -> nextAwake );
1059
1059
evt -> timeStep = time ;
1060
- pqueue_change_priority (evt -> queue , evt -> nextAwake , evt );
1060
+ ps_pqueue_change_priority (evt -> queue , evt -> nextAwake , evt );
1061
1061
1062
1062
return 0 ;
1063
1063
}
@@ -1080,11 +1080,11 @@ char EVT_sched_move_to_mono(EVTHandler *handler, void *eventId)
1080
1080
return 1 ;
1081
1081
}
1082
1082
1083
- pqueue_remove (evt -> queue , eventId );
1083
+ ps_pqueue_remove (evt -> queue , eventId );
1084
1084
ET_default_monotonic (NULL , & evt -> scheduleTime );
1085
1085
timeradd (& evt -> scheduleTime , & evt -> timeStep , & evt -> nextAwake );
1086
1086
evt -> queue = handler -> dbg_queue ;
1087
- pqueue_insert (evt -> queue , evt );
1087
+ ps_pqueue_insert (evt -> queue , evt );
1088
1088
1089
1089
return 0 ;
1090
1090
}
@@ -1119,7 +1119,7 @@ char EVT_sched_update_partial_credit(EVTHandler *handler, void *eventId,
1119
1119
evt -> nextAwake = now ;
1120
1120
1121
1121
evt -> timeStep = time ;
1122
- pqueue_change_priority (evt -> queue , evt -> nextAwake , evt );
1122
+ ps_pqueue_change_priority (evt -> queue , evt -> nextAwake , evt );
1123
1123
1124
1124
return 0 ;
1125
1125
}
@@ -1406,15 +1406,15 @@ static int edbg_client_msg(struct ZMQLClient *client, const void *data,
1406
1406
!strcasecmp (cmd , "clear_timed_breakpoint" ) ) {
1407
1407
evt = NULL ;
1408
1408
if (json_get_ptr_prop (data , dataLen , "id" , & id ) >= 0 ) {
1409
- for (i = 1 ; !evt && i <= pqueue_size (ctx -> queue ); i ++ )
1409
+ for (i = 1 ; !evt && i <= ps_pqueue_size (ctx -> queue ); i ++ )
1410
1410
if (ctx -> queue -> d [i ] == id )
1411
1411
evt = id ;
1412
1412
}
1413
1413
else if (json_get_string_prop (data , dataLen , "function" , & func ) >= 0 ) {
1414
1414
if (func ) {
1415
1415
id = dlsym (RTLD_DEFAULT , func );
1416
1416
free (func );
1417
- for (i = 1 ; id && !evt && i <= pqueue_size (ctx -> queue ); i ++ )
1417
+ for (i = 1 ; id && !evt && i <= ps_pqueue_size (ctx -> queue ); i ++ )
1418
1418
if ( ((ScheduleCB * )ctx -> queue -> d [i ])-> callback == id )
1419
1419
evt = ctx -> queue -> d [i ];
1420
1420
}
@@ -1557,7 +1557,7 @@ static void edbg_report_timed_events(struct IPCBuffer *json, EVTHandler *ctx,
1557
1557
first = 0 ;
1558
1558
}
1559
1559
1560
- for (i = 1 ; i <= pqueue_size (ctx -> queue ); i ++ ) {
1560
+ for (i = 1 ; i <= ps_pqueue_size (ctx -> queue ); i ++ ) {
1561
1561
edbg_report_timed_event (json , (ScheduleCB * )ctx -> queue -> d [i ],
1562
1562
cur_time , first );
1563
1563
first = 0 ;
0 commit comments