removes the rest of i/o polling, %behn and %ames now work

This commit is contained in:
Joe Bryan 2018-11-27 15:28:06 -05:00
parent 7e829d4c50
commit 1e17dc6fe6
4 changed files with 19 additions and 48 deletions

View File

@ -1120,12 +1120,12 @@
/* u3_behn_ef_bake(): notify %behn that we're live /* u3_behn_ef_bake(): notify %behn that we're live
*/ */
void void
u3_behn_ef_bake(void); u3_behn_ef_bake(u3_pier *pir_u);
/* u3_behn_ef_doze(): set or cancel timer /* u3_behn_ef_doze(): set or cancel timer
*/ */
void void
u3_behn_ef_doze(u3_noun wen); u3_behn_ef_doze(u3_pier *pir_u, u3_noun wen);
/** HTTP server. /** HTTP server.

View File

@ -27,9 +27,10 @@ void
u3_behn_io_init(u3_pier *pir_u) u3_behn_io_init(u3_pier *pir_u)
{ {
u3_behn* teh_u = pir_u->teh_u; u3_behn* teh_u = pir_u->teh_u;
teh_u->alm = c3n;
uv_timer_init(u3L, &teh_u->tim_u); uv_timer_init(u3L, &teh_u->tim_u);
teh_u->alm = c3n; teh_u->tim_u.data = pir_u;
} }
/* u3_behn_io_exit(): terminate timer. /* u3_behn_io_exit(): terminate timer.
@ -59,9 +60,9 @@ _behn_time_cb(uv_timer_t* tim_u)
/* u3_behn_ef_doze(): set or cancel timer /* u3_behn_ef_doze(): set or cancel timer
*/ */
void void
u3_behn_ef_doze(u3_noun wen) u3_behn_ef_doze(u3_pier *pir_u, u3_noun wen)
{ {
u3_behn* teh_u = &u3_Host.teh_u; u3_behn* teh_u = pir_u->teh_u;
if ( c3y == teh_u->alm ) { if ( c3y == teh_u->alm ) {
uv_timer_stop(&teh_u->tim_u); uv_timer_stop(&teh_u->tim_u);
@ -78,7 +79,6 @@ u3_behn_ef_doze(u3_noun wen)
u3_noun now = u3_time_in_tv(&tim_tv); u3_noun now = u3_time_in_tv(&tim_tv);
c3_d gap_d = u3_time_gap_ms(now, u3k(u3t(wen))); c3_d gap_d = u3_time_gap_ms(now, u3k(u3t(wen)));
teh_u->tim_u.data = pir_u;
uv_timer_start(&teh_u->tim_u, _behn_time_cb, gap_d, 0); uv_timer_start(&teh_u->tim_u, _behn_time_cb, gap_d, 0);
} }
@ -88,9 +88,9 @@ u3_behn_ef_doze(u3_noun wen)
/* u3_behn_ef_bake(): notify %behn that we're live /* u3_behn_ef_bake(): notify %behn that we're live
*/ */
void void
u3_behn_ef_bake(void) u3_behn_ef_bake(u3_pier *pir_u)
{ {
u3_noun pax = u3nq(u3_blip, c3__behn, u3k(u3A->sen), u3_nul); u3_noun pax = u3nq(u3_blip, c3__behn, u3k(u3A->sen), u3_nul);
u3v_plan(pax, u3nc(c3__born, u3_nul)); u3_pier_work(pir_u, pax, u3nc(c3__born, u3_nul));
} }

View File

@ -991,9 +991,12 @@ _pier_disk_consolidate(u3_pier* pir_u,
} }
/* XX boot sequence woes /* XX boot sequence woes
** these are duplicated here from _pier_loop_wake()
** because the order is important
*/ */
{ {
u3_ames_ef_bake(pir_u); u3_ames_ef_bake(pir_u);
u3_behn_ef_bake(pir_u);
} }
/* insert filesystem install event /* insert filesystem install event
@ -1662,6 +1665,10 @@ _pier_loop_wake(u3_pier* pir_u)
u3_ames_ef_bake(pir_u); u3_ames_ef_bake(pir_u);
u3a_lop(cod_l); u3a_lop(cod_l);
cod_l = u3a_lush(c3__behn);
u3_behn_ef_bake(pir_u);
u3a_lop(cod_l);
cod_l = u3a_lush(c3__http); cod_l = u3a_lush(c3__http);
u3_http_io_talk(); u3_http_io_talk();
u3_http_ef_bake(); u3_http_ef_bake();
@ -1711,38 +1718,6 @@ _pier_loop_exit(void)
} }
#endif #endif
/* _pier_loop_poll(): update listeners.
*/
static void
_pier_loop_poll(u3_pier* pir_u)
{
c3_l cod_l;
cod_l = u3a_lush(c3__ames);
u3_ames_io_poll(pir_u);
u3a_lop(cod_l);
cod_l = u3a_lush(c3__http);
u3_http_io_poll();
u3a_lop(cod_l);
cod_l = u3a_lush(c3__term);
u3_term_io_poll();
u3a_lop(cod_l);
cod_l = u3a_lush(c3__save);
u3_save_io_poll(pir_u);
u3a_lop(cod_l);
cod_l = u3a_lush(c3__unix);
u3_unix_io_poll(pir_u);
u3a_lop(cod_l);
cod_l = u3a_lush(c3__behn);
u3_behn_io_poll(pir_u);
u3a_lop(cod_l);
}
#if 0 #if 0
/* _pier_boot_seed(): build the cryptographic seed noun. /* _pier_boot_seed(): build the cryptographic seed noun.
*/ */
@ -1858,11 +1833,7 @@ _pier_boot_complete(u3_pier* pir_u,
static void static void
_pier_loop_prepare(uv_prepare_t* pep_u) _pier_loop_prepare(uv_prepare_t* pep_u)
{ {
pep_u = 0; _pier_loop_time();
{
_pier_loop_poll(u3_pier_stub());
_pier_loop_time();
}
} }
/* u3_pier_bail(): clean up all event state. /* u3_pier_bail(): clean up all event state.

View File

@ -182,13 +182,13 @@ _reck_kick_http(u3_pier* pir_u,
/* _reck_kick_behn(): apply packet network outputs. /* _reck_kick_behn(): apply packet network outputs.
*/ */
static u3_noun static u3_noun
_reck_kick_behn(u3_noun pox, u3_noun fav) _reck_kick_behn(u3_pier* pir_u, u3_noun pox, u3_noun fav)
{ {
switch ( u3h(fav) ) { switch ( u3h(fav) ) {
default: break; default: break;
case c3__doze: { case c3__doze: {
u3_behn_ef_doze(u3k(u3t(fav))); u3_behn_ef_doze(pir_u, u3k(u3t(fav)));
u3z(pox); u3z(fav); return c3y; u3z(pox); u3z(fav); return c3y;
} break; } break;
} }
@ -332,7 +332,7 @@ _reck_kick_spec(u3_pier* pir_u, u3_noun pox, u3_noun fav)
} break; } break;
case c3__behn: { case c3__behn: {
return _reck_kick_behn(pox, fav); return _reck_kick_behn(pir_u, pox, fav);
} break; } break;
case c3__clay: case c3__clay: