-
Couldn't load subscription status.
- Fork 1
Feature: carrow_asap & related functions #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| } | ||
| struct asapbag *bag = _asapbags[_asapbagscount]; | ||
|
|
||
| if (bag == NULL) { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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 */ |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asapmax is garbage here.
There was a problem hiding this 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
_asapbagscounton mainloop conditions(terminate and before wait).
| return -1; | ||
| } | ||
|
|
||
| _asapsmax = asapsmax; |
There was a problem hiding this comment.
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))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check _asapbags.
No description provided.