hnes/libaco

Feature Request: aco_get_co() return NULL when the caller is main co

Opened this issue · 4 comments

I'm wonder how to determine main co and non-main co while executing the same function.
As the document said, aco_get_co() should be called by non-main co.
How about returning NULL pointer to reveal the caller is main co ??

hnes commented

Thanks for your proposal, but I'm afraid I may not have enough spare time to do this recently.

I would like to give you a workaround:

func check_is_in_main_co
	this_co = aco_get_co()
	if this_co == main_co || this_co == NULL 
		return true
	else
		return false
hnes commented

In addition, for the sake of compatibility, I think adding a new API is a better choice.

Thanks for your acception. Maybe I could issue a PR later.

Please review PR #49. Thanks !!!