multithreading Questions

1

I'm looking to catch IOExceptions caused by a broken pipe before the async threads dispatch the result to Tomcat. Essentially the client disconnects and the error bubbles up to Tomcat before I can ...
Sandry asked 10/3, 2023 at 20:30

2

Consider this example: #include <iostream> #include <atomic> #include <thread> #include <chrono> #include <cassert> int main(){ std::atomic<int> v = 0; std::at...
Eijkman asked 23/10 at 13:20

1

Solved

Consider this example: #include <iostream> #include <atomic> #include <thread> struct SpinLock{ std::atomic<bool> state; void lock(){ bool expected = false; while(!stat...
Tricksy asked 17/10 at 13:41

5

I recently finished a script to ping every computer/workstation on a list and output it in a nice format. There are thousands of computers to ping on the next list so it would take a while to run...
Tirade asked 21/6, 2016 at 20:29

2

Solved

I want to use threading.Lock() in a async function, asyncio.Lock() is not thread safe so I cannot do with await asyncio.Lock():. The reason I need to use threading.Lock() is because this object may...
Footboy asked 14/8, 2020 at 21:49

2

Solved

I've been experimenting with GCD priorities recently. Here's the snippet of code that I've been working with. for _ in 1...1000 { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_...
Speckle asked 30/8, 2016 at 18:51

4

Solved

I read that pthread is C library and is not compatible with C++ object model, especially when talking about exception handling. So I wish to know on linux system, how gcc/clang implements std::thr...
Condyloma asked 11/8, 2017 at 10:16

5

I have a main thread that waits for connection. It spawns client threads that will echo the response from the client (telnet in this case). But say that I want to close down all sockets and all thr...
Leenaleeper asked 26/5, 2010 at 17:4

4

Solved

On Windows, you can call SetProcessAffinityMask for a process and SetThreadAffinityMask for a thread. However, Windows only appears to expose GetProcessAffinityMask and not a similar API for indivi...
Drag asked 6/7, 2011 at 19:30

1

I am trying to understand a simple example and wonder why I don't see more false sharing than reported by perf c2c. In my example (a matrix multiplication), two instances could cause false sharing ...
Drily asked 8/9 at 16:1

3

I have single thread process which executes some long time. I need several users to have access to execute this process and I choose http protocol to manage invocation. Naturally, when one process...
Blackfoot asked 24/1, 2016 at 15:56

3

Solved

I see frequent mention that Swift arrays, due to copy-on-write, are not threadsafe, but have found this works, as it updates different and unique elements in an array from different threads simulta...
Composition asked 15/2, 2023 at 12:1

1

For a better understanding of this question, here is the code: // code 1 #include <iostream> #include <thread> struct tls_test { tls_test() { std::cout << "tls_test ctor\n...
Thanasi asked 25/6, 2023 at 2:39

4

This is more of a theoretical question. I'm not sure if all concepts, compiler behaviors, etc. are uptodate and still in use, but I'd like to have confirmation if I'm correctly understanding some c...
Simonette asked 23/4, 2016 at 13:22

2

I have a module written in python. this module is sort of an interface to many different functionalities I implemented in Python: EmbeddingInterface.py simply imports this module and creates an in...
Denominationalism asked 7/9, 2016 at 18:7

1

cppreference is explicit about calling std::shared_future<T>::wait from multiple threads: Calling wait on the same std::shared_future from multiple threads is not safe; the intended use is f...
Blotter asked 23/3, 2021 at 14:27

3

How do you return an item to a queue.Queue? This would be useful in threading or multiprocessing if the task fails, so that the task can not be lost. The docs for queue.Queue.get() say that the fu...
Metabolize asked 15/4, 2017 at 4:2

4

What is the simplest way to wait for more objects than MAXIMUM_WAIT_OBJECTS? MSDN lists this: Create a thread to wait on MAXIMUM_WAIT_OBJECTS handles, then wait on that thread plus the other han...
Fervent asked 27/2, 2011 at 23:19

2

Solved

i am trying to create producer and send some data to it from intellij idea but while running this program i got ERROR like ERROR org.apache.kafka.common.utils.KafkaThread - Uncaught exception in th...

5

Solved

Failing to call shutdown() on a thread executor will result in a never terminating application. Best practice to shut down the ExecutorService is this: ExecutorService service = null; try { ser...
Lens asked 30/12, 2016 at 9:0

1

I ran into the kind of a problem described in this question: How can I create a Tokio runtime inside another Tokio runtime without getting the error "Cannot start a runtime from within a runti...
Photodrama asked 27/10, 2021 at 9:23

2

I am a new to the latest Java versions and I found this concept of virtual threads which many servers are now using. In the same context I wanted to use a ThreadLocal field in the virtual thread co...
Upholstery asked 19/8 at 17:16

2

Making an array or dictionary a value type by definition, but then actually copying it only when one reference to it tries to modify it is a lovely idea, but it makes me wary in a multi-queued/thre...
French asked 14/8, 2020 at 15:11

4

Solved

I'm creating cross platform software in Visual Studio 2012 express on Windows. For obvious reasons I can't use .NET's System::Threading::Thread. I was hoping I could use the new threading features ...
Spastic asked 28/2, 2013 at 17:37

3

Solved

I noticed the following behavior in the following code (using threading.Timer class): import threading def ontimer(): print threading.current_thread() def main(): timer = threading.Timer(2, on...
Schoolfellow asked 18/6, 2012 at 12:55

© 2022 - 2024 — McMap. All rights reserved.