Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions aco.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,8 @@ void aco_destroy(aco_t* co){
free(co);
}
}

int aco_is_in_main_co(void){
if(aco_gtls_co->main_co == NULL || aco_gtls_co == NULL) return 1;
else return 0;
}
3 changes: 3 additions & 0 deletions aco.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ extern __thread aco_t* aco_gtls_co;
aco_attr_no_asan
extern void aco_resume(aco_t* resume_co);

/* Return 1 if the function is directly called by main co; 0 is called by non-main co*/
extern int aco_is_in_main_co(void);

//extern void aco_yield1(aco_t* yield_co);
#define aco_yield1(yield_co) do { \
aco_assertptr((yield_co)); \
Expand Down