2013-09-23 14:34:35 -04:00
|
|
|
int main() {
|
2015-04-28 13:45:35 -04:00
|
|
|
static Philo l_philo[N]; /* N Philo active objects */
|
|
|
|
static QEvt const *l_philQueueSto[N][N]; /* storage for event queues */
|
|
|
|
static int l_philoStk[N][256]; /* stacks for the Philo active objects */
|
|
|
|
|
2012-08-14 18:07:04 -04:00
|
|
|
. . .
|
|
|
|
for (n = 0; n < N; ++n) {
|
2015-04-28 13:45:35 -04:00
|
|
|
TableEvt ie; /* initialization event for the Philo SM */
|
2012-08-14 18:07:04 -04:00
|
|
|
ie.philNum = n;
|
2013-09-23 14:34:35 -04:00
|
|
|
Philo_ctor(&l_philo[n]);
|
2015-12-24 14:33:20 -05:00
|
|
|
QACTIVE_START((QActive *)&l_philo[n], /* Philo pointer */
|
|
|
|
(uint_fast8_t)(n*10 + 1), /* priority */
|
2013-09-23 14:34:35 -04:00
|
|
|
l_philoQueueSto[n], Q_DIM(l_philoQueueSto[n]), /* queue */
|
2015-12-24 14:33:20 -05:00
|
|
|
l_philoStk[n], sizeof(l_philoStk[n]), /* per AO stack */
|
|
|
|
&ie.super); /* initialization event */
|
2012-08-14 18:07:04 -04:00
|
|
|
}
|
|
|
|
. . .
|
|
|
|
}
|