Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polyorb-hi-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TASTE
polyorb-hi-c
Commits
d9f22c65
PL1
Commit
d9f22c65
authored
5 years ago
by
bouazizrahma
Browse files
Options
Downloads
Patches
Plain Diff
extend gqueue and types packages to support dispatch pattern from BA for sporadic threads
parent
8846ef04
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/po_hi_gqueue.h
+36
-0
36 additions, 0 deletions
include/po_hi_gqueue.h
include/po_hi_types.h
+25
-0
25 additions, 0 deletions
include/po_hi_types.h
src/po_hi_gqueue.c
+83
-0
83 additions, 0 deletions
src/po_hi_gqueue.c
with
144 additions
and
0 deletions
include/po_hi_gqueue.h
+
36
−
0
View file @
d9f22c65
...
...
@@ -130,6 +130,42 @@ int __po_hi_gqueue_next_value(__po_hi_task_id id,
int
__po_hi_gqueue_get_count
(
__po_hi_task_id
id
,
__po_hi_local_port_t
port
);
/**
* \brief Compute dispatch condition :
* return 1 when the condition of one of the transitions that stemmed from the next
* complete state is verified (i.e. all its dispatch triggers received events on
* their corresponding ports) else return 0.
* It also sets the index of the transition to execute according to the condition that is
* verified.
*
* \param id thread identifier in the local process.
* \param next_complete_state the struct that contains arrays informations about
* transitions and dispatch triggers of the next complete state.
* \param initial_sizes_of_dispatch_triggers_of_all_transitions array that contains the number of
* events that are pending each dispatch ports of all transitions.
* \param index_transition_to_execute the index of transition to execute,
* this parameter will be set according to the transition whose condition is verified.
*/
__po_hi_bool_t
__po_hi_gqueue_compute_index_transition_to_execute
(
__po_hi_task_id
id
,
__po_hi_ba_automata_state_t
*
next_complete_state
,
int
*
initial_sizes_of_dispatch_triggers_of_all_transitions
,
__po_hi_int32_t
*
index_transition_to_execute
);
/**
* \brief Wait until all the specified dispatch events (according to the next complete state)
* are received on the corresponding ports for a given thread.
*
* \param id thread identifier in the local process.
* \param next_complete_state the struct that contains arrays informations about
* transitions and dispatch triggers of the next complete state.
* \param index_transition_to_execute the index of transition to execute,
* this parameter will be set according to the transition whose condition is verified.
*/
void
__po_hi_gqueue_wait_for_specific_incoming_events
(
__po_hi_task_id
id
,
__po_hi_ba_automata_state_t
*
next_complete_state
,
__po_hi_int32_t
*
index_transition_to_execute
);
/**
* \brief Wait until an event is received on any port for a given thread.
*
...
...
This diff is collapsed.
Click to expand it.
include/po_hi_types.h
+
25
−
0
View file @
d9f22c65
...
...
@@ -104,6 +104,31 @@ typedef enum
__PO_HI_INVALID_PORT_KIND
=
50
}
__po_hi_port_kind_t
;
typedef
enum
{
__po_hi_initial
,
__po_hi_initial_complete
,
__po_hi_initial_complete_final
,
__po_hi_initial_final
,
__po_hi_complete
,
__po_hi_complete_final
,
__po_hi_final
,
__po_hi_execution
}
__po_hi_state_kind_t
;
typedef
struct
{
__po_hi_int32_t
nb_transitions
;
__po_hi_int32_t
*
nb_dispatch_triggers_of_each_transition
;
__po_hi_int32_t
*
dispatch_triggers_of_all_transitions
;
__po_hi_int32_t
nb_of_all_dispatch_events
;
}
__po_hi_ba_automata_state_t
;
void
__po_hi_copy_array
(
void
*
dst
,
void
*
src
,
__po_hi_uint32_t
size
);
#endif
/* __PO_HI_TYPES_H_ */
This diff is collapsed.
Click to expand it.
src/po_hi_gqueue.c
+
83
−
0
View file @
d9f22c65
...
...
@@ -417,6 +417,89 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
return
__PO_HI_SUCCESS
;
}
/******************************************************************************/
__po_hi_bool_t
__po_hi_gqueue_compute_index_transition_to_execute
(
__po_hi_task_id
id
,
__po_hi_ba_automata_state_t
*
next_complete_state
,
int
*
initial_sizes_of_dispatch_triggers_of_all_transitions
,
__po_hi_int32_t
*
index_transition_to_execute
)
{
__po_hi_int32_t
i
=
0
;
__po_hi_bool_t
dispatch_condition_of_any_transition_is_verified
=
0
;
__po_hi_int32_t
tmp
=
0
;
__po_hi_int32_t
j
=
0
;
__po_hi_bool_t
dispatch_condition
;
while
(
i
<
next_complete_state
->
nb_transitions
&&
!
dispatch_condition_of_any_transition_is_verified
)
{
dispatch_condition
=
1
;
while
(
j
<
(
tmp
+
next_complete_state
->
nb_dispatch_triggers_of_each_transition
[
i
])
&&
dispatch_condition
)
{
dispatch_condition
=
(
initial_sizes_of_dispatch_triggers_of_all_transitions
[
j
]
<
__po_hi_gqueue_get_count
(
id
,
next_complete_state
->
dispatch_triggers_of_all_transitions
[
j
]));
j
++
;
}
if
(
dispatch_condition
)
{
*
index_transition_to_execute
=
i
+
1
;
}
tmp
=
tmp
+
next_complete_state
->
nb_dispatch_triggers_of_each_transition
[
i
];
j
=
tmp
;
dispatch_condition_of_any_transition_is_verified
=
dispatch_condition
;
i
++
;
}
return
dispatch_condition
;
}
/******************************************************************************/
void
__po_hi_gqueue_wait_for_specific_incoming_events
(
__po_hi_task_id
id
,
__po_hi_ba_automata_state_t
*
next_complete_state
,
__po_hi_int32_t
*
index_transition_to_execute
)
{
/* Locking only the mutex of the semaphore */
int
result
=
__po_hi_sem_mutex_wait_gqueue
(
__po_hi_gqueues_semaphores
,
id
);
__DEBUGMSG
(
"GQUEUE_SEM_MUTEX_WAIT %d %d
\n
"
,
id
,
result
);
assert
(
result
==
__PO_HI_SUCCESS
);
int
initial_sizes_of_dispatch_triggers_of_all_transitions
[
next_complete_state
->
nb_of_all_dispatch_events
];
for
(
int
i
=
0
;
i
<
(
next_complete_state
->
nb_of_all_dispatch_events
);
i
++
)
{
initial_sizes_of_dispatch_triggers_of_all_transitions
[
i
]
=
__po_hi_gqueue_get_count
(
id
,
next_complete_state
->
dispatch_triggers_of_all_transitions
[
i
]);
}
*
index_transition_to_execute
=
-
1
;
while
(
!
__po_hi_gqueue_compute_index_transition_to_execute
(
id
,
next_complete_state
,
initial_sizes_of_dispatch_triggers_of_all_transitions
,
index_transition_to_execute
))
{
__PO_HI_INSTRUMENTATION_VCD_WRITE
(
"0t%d
\n
"
,
id
);
/* Telling the semaphore to wait with putting its condvar on wait mode */
int
res_sem
=
__po_hi_sem_wait_gqueue
(
__po_hi_gqueues_semaphores
,
id
);
__DEBUGMSG
(
"GQUEUE_SEM_WAIT %d %d
\n
"
,
id
,
res_sem
);
assert
(
res_sem
==
__PO_HI_SUCCESS
);
__PO_HI_INSTRUMENTATION_VCD_WRITE
(
"1t%d
\n
"
,
id
);
}
#if defined (MONITORING)
record_event
(
SPORADIC
,
WAIT_FOR
,
id
,
invalid_port_t
,
invalid_port_t
,
*
port
,
invalid_local_port_t
,
NULL
);
#endif
/** Releasing only the mutex of the semaphore*/
int
res
=
__po_hi_sem_mutex_release_gqueue
(
__po_hi_gqueues_semaphores
,
id
);
__DEBUGMSG
(
"GQUEUE_SEM_MTUEX_RELEASE %d %d
\n
"
,
id
,
res
);
assert
(
res
==
__PO_HI_SUCCESS
);
#ifdef __PO_HI_GQUEUE_ASSERTIONS
__DEBUGMSG
(
"
\n
The task queue must be considered not empty "
);
#endif
}
/******************************************************************************/
void
__po_hi_gqueue_wait_for_incoming_event
(
__po_hi_task_id
id
,
__po_hi_local_port_t
*
port
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment