Comments (4)
我还是抽空写个使用文档吧……
from uv-cpp.
如果这些server跑在同一个线程,那没什么问题。如果这些server跑在不同线程,相互之间不交互数据,那也没什么问题。如果这些server跑在不同线程并且相互要交互数据,由于libuv本身不是线程线程安全,通过async接口交互数据就没问题(在loop1注册一个函数到loop2里面执行),在uv-cpp里面封装成了uv::EventLoop::runInThisLoop接口。只要每个线程都单独开一个loop,就没问题。
from uv-cpp.
需要注意的是这些对象的构造函数也不是线程安全的(因为要注册到loop里面去)。举个例子,在loop1里面创建一个loop2线程下运行的client。
loop2->runInThisLoop([loop2]() { uv::TcpClient(loop2); });
from uv-cpp.
方便写个例子程序参考吗?刚刚开始学习您的uv-cpp的库,还不太了解
from uv-cpp.
Related Issues (20)
- TcpConnection::write函数中似乎有隐藏的内存泄露问题? HOT 3
- TcpServer在客户端断开后发送数据崩溃 HOT 3
- uv::Packet::readFromBuffer 的解包问题? HOT 3
- new EventLoop,再delete,VS报告内存泄露 HOT 1
- 下一个版本解决问题。 HOT 21
- packet中size为uint16_t存放数据长度是否太小? HOT 2
- 新版的代码中有未定义的 ssize_t
- 编译出错 HOT 2
- TimerWheel 类的是否会将没有超时连接删除 HOT 8
- 请问是否支持ssl? HOT 1
- 关于内存的释放问题 HOT 5
- httpserver长链接
- uv-cpp做客户端时,当服务端连不上,重复去连接时,无论是linux还是Windows都会奔溃 HOT 14
- libuv升级到新版本支持吗 HOT 1
- client跨线程循环发送时候 ,client崩溃 HOT 4
- linux centos7下,偶现程序运行一段时间后,CPU使用率100%的情况。最后奔溃。 HOT 1
- centos 7 运行一晚第二天看到崩溃了 HOT 2
- 请教下 这个可以支持百万或者千万并发吗? HOT 3
- 你好,cmake和make之后该怎么运行helloworld例子 HOT 3
- async 有对应的例子吗?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uv-cpp.