mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-29 12:15:43 +03:00
updates u3_raft_work() to be async, adds sync u3_raft_play()
This commit is contained in:
parent
6e77f2b2c1
commit
d8b7068345
@ -1104,7 +1104,12 @@
|
||||
void
|
||||
u3_raft_init(void);
|
||||
|
||||
/* u3_raft_work(): poke, kick, and push pending events.
|
||||
/* u3_raft_play(): synchronously poke, kick, and push pending events.
|
||||
*/
|
||||
void
|
||||
u3_raft_play(void);
|
||||
|
||||
/* u3_raft_work(): asynchronously poke, kick, and push pending events.
|
||||
*/
|
||||
void
|
||||
u3_raft_work(void);
|
||||
|
@ -442,6 +442,7 @@ u3_lo_shut(c3_o inn)
|
||||
if ( c3n == u3_Host.liv ) {
|
||||
// direct save and die
|
||||
//
|
||||
u3_raft_play();
|
||||
// u3_lo_grab("lo_exit", u3_none);
|
||||
// u3_loom_save(u3A->ent_d);
|
||||
// u3_loom_exit();
|
||||
|
44
vere/raft.c
44
vere/raft.c
@ -2070,26 +2070,38 @@ u3_raft_chip(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* u3_raft_work(): work, either synchronously or asynchronously.
|
||||
/* u3_raft_play(): synchronously process events.
|
||||
*/
|
||||
void
|
||||
u3_raft_play(void)
|
||||
{
|
||||
c3_assert( u3Z->typ_e == u3_raty_lead );
|
||||
|
||||
u3_raft_chip();
|
||||
|
||||
if ( u3_nul != u3A->roe ) {
|
||||
u3_raft_play();
|
||||
}
|
||||
}
|
||||
|
||||
/* _raft_work_cb(): callback to recurse into u3_raft_work().
|
||||
*/
|
||||
static void
|
||||
_raft_work_cb(uv_timer_t* tim_u)
|
||||
{
|
||||
u3_raft_work();
|
||||
}
|
||||
|
||||
/* u3_raft_work(): asynchronously process events.
|
||||
*/
|
||||
void
|
||||
u3_raft_work(void)
|
||||
{
|
||||
if ( u3Z->typ_e != u3_raty_lead ) {
|
||||
c3_assert(u3A->ova.egg_p == 0);
|
||||
if ( u3_nul != u3A->roe ) {
|
||||
uL(fprintf(uH, "raft: dropping roe!!\n"));
|
||||
u3z(u3A->roe);
|
||||
u3A->roe = u3_nul;
|
||||
}
|
||||
}
|
||||
else {
|
||||
c3_assert( u3Z->typ_e == u3_raty_lead );
|
||||
|
||||
// Cartify, jam, and encrypt this batch of events.
|
||||
// Take a number, Raft will be with you shortly.
|
||||
//
|
||||
while ( u3_nul != u3A->roe ) {
|
||||
u3_raft_chip();
|
||||
}
|
||||
u3_raft_chip();
|
||||
|
||||
if ( u3_nul != u3A->roe ) {
|
||||
uv_timer_start(&u3Z->tim_u, _raft_work_cb, 0, 0);
|
||||
}
|
||||
}
|
||||
|
@ -595,7 +595,8 @@ _sist_zest()
|
||||
}
|
||||
|
||||
// Work through the boot events.
|
||||
u3_raft_work();
|
||||
//
|
||||
u3_raft_play();
|
||||
}
|
||||
|
||||
/* _sist_rest_nuu(): upgrade log from previous format.
|
||||
@ -1223,8 +1224,9 @@ u3_sist_boot(void)
|
||||
u3C.wag_w |= u3o_hashless;
|
||||
}
|
||||
|
||||
// process pending events
|
||||
u3_raft_work();
|
||||
// process pending events
|
||||
//
|
||||
u3_raft_play();
|
||||
}
|
||||
else {
|
||||
u3_noun pig, who;
|
||||
|
Loading…
Reference in New Issue
Block a user