Skip to content
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

Question: Does libaco only have the implementation of shared stack mode? #19

Closed
lancewz opened this issue Aug 16, 2018 · 6 comments
Closed
Labels
answered question Further information is requested

Comments

@lancewz
Copy link

lancewz commented Aug 16, 2018

只有共享栈的实现么?


Does libaco only have the implementation of shared stack mode?

@hnes hnes changed the title 只有共享栈的实现么? Question: Does libaco only have the implementation of shared stack mode? Aug 17, 2018
@hnes hnes added the question Further information is requested label Aug 17, 2018
@hnes
Copy link
Owner

hnes commented Aug 17, 2018

libaco also support standalone-stack coroutine.

As the documentation described, if a shared stack has only one user coroutine, then we could call this coroutine a standalone-stack coroutine.

There is also a demonstration of a standalone-stack coroutine in the test_aco_tutorial_2.c.

I hope this answer is helpful for you :D

@hnes hnes added the answered label Aug 17, 2018
@lancewz
Copy link
Author

lancewz commented Aug 17, 2018

Yes I see. Thank you!
Can I build libaco with gcc 4.4.6?
The complier report error like this "错误:隐式声明函数‘_Static_assert’".

@hnes
Copy link
Owner

hnes commented Aug 17, 2018

Since the _Static_assert keyword only been supported in gcc4.6 and newer (AFAIK), you may need to use newer compiler toolchain to build libaco.

But as a hack with older gcc (before gcc4.6), you could try the build command below (since all the _Static_assert check during compiling time in libaco is always true on nearly all common platforms):

$ EXTRA_CFLAGS='-D_Static_assert(...)=' bash make.sh

@hnes
Copy link
Owner

hnes commented Aug 17, 2018

Thank you very much for your report, @lancewz ;-)

I would like to add such friendly support for older gcc in the next release of libaco.

@lancewz
Copy link
Author

lancewz commented Aug 17, 2018

I build libaco successfully follow your advice.
I want to fork libaco and import the features of Tencent's libco (hook I/O functions and do event process).
Thank you very much.

@hnes
Copy link
Owner

hnes commented Aug 17, 2018

I want to fork libaco and import the features of Tencent's libco (hook I/O functions and do event process).

It is a very cool and nice idea :D

I'm now developing a golang-like & libaco-based C coroutine scheduler and would probably be released in several days. These two projects we are developing have something in common. Looking forward to your excellent project!

@hnes hnes closed this as completed Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants