Skip to content

Conversation

@thecapn32
Copy link
Contributor

No description provided.

}
struct asapbag *bag = _asapbags[_asapbagscount];

if (bag == NULL) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always happening situation. if no needed.

};


struct asapbag {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use struct evbag instead. We need to schedule coroutines to run as soon as possible.



static void
asap_trigger() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ues carrow_trigger instead.

typedef void (*carrow_generic_corofunc) (void *coro, void *state);


/* A function pointer type representing a carrow asap function */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not define it.



int
carrow_asap_register(carrow_asapfunc func, void *params);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature must be similar to carrow_evloop_register.

int
CARROW_NAME(forever) (CARROW_NAME(corofunc) f, CARROW_ENTITY *state,
volatile int *status) {
volatile int *status, unsigned int asapsmax) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asapmax is garbage here.

Copy link
Owner

@pylover pylover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Define a macro similar with CORO_WAIT for asap running.
  • Check _asapbagscount on mainloop conditions(terminate and before wait).

return -1;
}

_asapsmax = asapsmax;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get or set it by two accessors:

int
carrow_asapmax_get();

void
carrow_asapmax_set(int count);

}

evloop:
while (_evbagscount && ((status == NULL) || (*status > EXIT_FAILURE))) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check _asapbags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants