-
Notifications
You must be signed in to change notification settings - Fork 758
Home
_ _ _
| (_) |__ __ _ ___
| | | '_ \ / _` |/ _ \
| | | |_) | (_| | (_) |
|_|_|_.__/ \__, |\___/
|___/
Welcome to the libgo wiki!
libgo is a library that introduces Go-style concurrency to C++.
It was implemented with C++11, you can build it on Linux & Windows platforms.
The most powerful function in libgo is compatibility.
If you will link a 3-party synchronous library into you program, most of other coroutine-library will be blocked when 3-party library called blocking network syscall.
But, if you use libgo
, it can avoid thread blocked. It will hook blocking network syscall to add filescriptor into epoll
, yield
current coroutine and run other coroutines. Wait the filescriptor readable or writable, the coroutine will resume.
So, you can use synchronous library directly in you program, likes curl
hiredis
mysqlclient
, and so on.
libgo
is a complete development framework, it supports most of feature for development, likes coroutine mutex
, coroutine read-write mutex
, channel
, timer
, await
and so on.
Go | libgo(C++) |
---|---|
go foo() | go foo; |
go foo(arg1, arg2) | go [=]{ foo(arg1, arg2); }; |
runtime.Gosched() | co_yield; |
c := make(chan bool) | co_chan<bool> c; |
c <- x | c << x; |
x := <- c | c >> x; |