Comments (5)
Hey! Thanks for reporting the issue. Also, Merry Christmas!!
I will take a look at it and get back to you.
from cpp-subprocess.
Merry Christmas to you too π
from cpp-subprocess.
I tried reproducing this with std::thread instead of Open MP:
void test_multithreaded_exec()
{
auto thread_fn = []() {
auto p = sp::Popen({"cat", "-"}, sp::input{sp::PIPE}, sp::output{sp::PIPE});
auto msg = "through stdin to stdout";
auto res_buf = p.communicate(msg, strlen(msg)).first;
assert(res_buf.length == strlen(msg));
};
std::vector<std::thread> threads;
for (int i = 0; i < 100; i++) {
threads.emplace_back(std::thread{thread_fn});
}
for (int i=0; i < 100; i++) {
threads[i].join();
}
std::cout << "END_TEST" << std::endl;
}
Popen object if used within a thread context should be thread safe. Is there any Open MP specific thing going on here ?
from cpp-subprocess.
Hi @arun11299 I failed to reproduce the issue on an MCVE.
That suggests that there is a memory corruption happening somewhere else in my code that's causing the issue.
Thanks a lot for looking into this. I'll investigate further and will let you know if I have any useful findings.
from cpp-subprocess.
Sure. Let me know.
from cpp-subprocess.
Related Issues (20)
- How to communicate with interactive shell scriptοΌ HOT 1
- memory leak HOT 2
- crash HOT 6
- string comparison issue on win32 HOT 1
- Thread safety? HOT 2
- missing inline in three MSVC specific functions HOT 1
- MinGW support HOT 1
- Windows support for environment variables HOT 2
- add option to redirect output to stdout
- [Question] Why delete operator= for the Streams class? HOT 4
- Blocking when using read_all with socket stream
- Busy looping when waiting for subprocess to finish HOT 1
- Conan support HOT 1
- wait() / communicate() can hang indefinitely with no recourse
- Popen blocking on Windows HOT 2
- Support CPM / cmake
- Compare with similar/related libraries HOT 2
- question: condition for `communicate_threaded` HOT 1
- Some windows errors HOT 1
- Issue with quotes on windows HOT 15
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 cpp-subprocess.