This is a creation in Article, where the information may have evolved or changed.
Libgo is a stackful co-libraries with collaborative scheduling written in C + + and a powerful parallel programming library.
At the beginning of the design, it provides the framework support for the development of high concurrency distributed Linux Server program, which can make the third-party library with the link-to-program synchronization become the asynchronous library, and improve its performance without affecting the logic .
Currently supports two platforms:
Use LIBGO to write parallel programs that can be developed quickly and logically as well as Golang, with the performance benefits of C + + native.
1. Provide Golang General function powerful Association, write code based on Corontine, can write simple code in a synchronous way, and get asynchronous performance
2. Support massive coprocessor, create 1 million co-process only using 2GB memory
3. Allow users to freely control the scheduling point, change the number of scheduling threads anytime, anywhere;
4. Support multi-thread scheduling process, easy to write parallel code, efficient parallel scheduling algorithm, can effectively utilize multiple CPU cores
5. You can make the third-party library of the linked-to-program synchronization become an asynchronous call, greatly improving its performance. No more worrying. Some DB officials do not provide asynchronous driver, such as Hiredis, Mysqlclient, which can be used directly by the client driver, and can get the performance of not losing to asynchronous driver.
6. Dynamic links and static links are all supported, making it easy to use c++11 's user static chaining to deliver executables and deploy to low-version Linux systems.
7. Provide Co_mutex, timers, channel and other features to help users to write programs more easily.
8. Strong network performance, on the Linux system beyond the ASIO asynchronous model, especially in the processing of small packets and multi-threaded parallelism is very powerful
In the source code of the Samples directory there are many sample code, including detailed instructions, so that users can easily learn to use the LIBGO.
?
12345678910111213141516171819 |
#include <stdio.h>
#include <libgo/coroutine.h> co_main(
int
argc,
char
**argv)
{
go []{
printf
(
"1\n"
);
co_yield;
printf
(
"2\n"
);
};
go []{
printf
(
"3\n"
);
co_yield;
printf
(
"4\n"
);
};
return
0;
}
|
Http://www.oschina.net/p/libgo