Feature: carrow_asap & related functions#4
Open
thecapn32 wants to merge 1 commit into
Open
Conversation
pylover
requested changes
Jun 23, 2023
| } | ||
| struct asapbag *bag = _asapbags[_asapbagscount]; | ||
|
|
||
| if (bag == NULL) { |
Owner
There was a problem hiding this comment.
Always happening situation. if no needed.
| }; | ||
|
|
||
|
|
||
| struct asapbag { |
Owner
There was a problem hiding this comment.
Use struct evbag instead. We need to schedule coroutines to run as soon as possible.
|
|
||
|
|
||
| static void | ||
| asap_trigger() { |
| typedef void (*carrow_generic_corofunc) (void *coro, void *state); | ||
|
|
||
|
|
||
| /* A function pointer type representing a carrow asap function */ |
|
|
||
|
|
||
| int | ||
| carrow_asap_register(carrow_asapfunc func, void *params); |
Owner
There was a problem hiding this comment.
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) { |
pylover
requested changes
Jun 23, 2023
pylover
left a comment
Owner
There was a problem hiding this comment.
- Define a macro similar with CORO_WAIT for asap running.
- Check
_asapbagscounton mainloop conditions(terminate and before wait).
| return -1; | ||
| } | ||
|
|
||
| _asapsmax = asapsmax; |
Owner
There was a problem hiding this comment.
Get or set it by two accessors:
int
carrow_asapmax_get();
void
carrow_asapmax_set(int count);| @@ -314,6 +396,10 @@ carrow_evloop(volatile int *status) { | |||
|
|
|||
| evloop: | |||
| while (_evbagscount && ((status == NULL) || (*status > EXIT_FAILURE))) { | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.