Is the std :: exception_ptr thread secure?

I have a worker thread that is constantly running, created & managed through a std::thread. At the top level of my worker thread, I have a try/catch block with a while loop inside it. If an exception leaks through to the top level of the thread, I ca

How do I use a runnable to do work in a singleton?

I have a question about using a runnable to do work in a singleton. I have an EventCoordinator class that is a singleton because it is the one that handles all events (and because my assignment requires me to do so). Events get added to this coordina

Spring MVC Application / truncated session bean-security

I'm trying to figure out how spring manages to inject thread safe request/session scoped bean in controller component (which is singleton and multiple threads accessing those beans through methods). As example consider HttpServletRequest field in con

Android 5 bitmap drawing issues

Wrote view with background rendering to Bitmap. Code below, it's big, but simple. Two bitmaps. One to draw on the screen, second for custom draw. After drawing is done, bitmaps are switched. On Android 4.x everything works fine. On Android 5 everythi

How to create a packaged_task with a member function?

On the program below, I'm trying to create a packaged_task with a member function: #include <future> using namespace std; struct S { int calc(int& a) { return a*a; } }; int main() { S s; auto bnd = std::bind(&S::calc, s); std::packaged_task&

C # Threaded messages with TcpClient (various errors)

I need to sent 500 messaged over a TCP connection and receive a response for each message within limited time, using threading to remain within the time. This is new to me and I spent a lot of time searching the forums before I put it up here, so ple

Does any of the built-in python modules use threads?

Will importing/using any of python's built in libraries spawn threads without being explicitly asked?The multiprocessing module and subprocess module both spawn threading.Thead objects internally to help handle I/O with the processes they spawn. Spec

Check the locking and reordering of the code in Java

In some article I read that double check locking is broken. As the compiler can reorder the sequence of constructors. Ss allocate memory for an object Then return the address to a reference variable Then initialize the state of the object While typic

Execute a member function of a class

I am trying to experiment the C++11 threads in a way that it accepts a member function of a class as a parameter into the thread constructor as shown in the first code snippet below on line 20 that is marked . The class definition is given in the 2nd

Pass a parameter to threads in a loop

I need to create 10 threads and print out the threadId with which thread printed. #include <windows.h> #include <stdio.h> DWORD WINAPI xprint(LPVOID Param) { DWORD tID = GetCurrentThreadId(); int count = *(int*)Param + 1; fprintf(stderr, "

Timer / Refresh the feature for the text box

In my application, I have two text boxes accompanied with two labels: "Connected" and "Not Connected". As seen in my code, if a connection is established, the "Connected" text box will fill with Green, indicating a network co

Multithreading with _beginthread in C ++ / CLI

I'm having a problem with _beginthread in microsoft visual studio c++ 10 express: my code: void __cdecl DashThread( void * Args ) // function without any class refs { while(1){ MessageBox::Show("work"); Sleep(5000); } _endthread(); } private: Sy

Call the method right after blocking the call

I'm using a third party library which has a blocking function, that is, it won't return until it's done; I can set a timeout for that call. Problem is, that function puts the library in a certain state. As soon as it enters that state, I need to do s

Can static tables be accessed safely from multiple threads?

If each thread is guaranteed to only read/write to a specific subset of the array can multiple threads work on the same (static) array without resorting to critical sections, etc? EDIT - This is for the specific case of arrays of non-reference-counte

Send the intent of the thread

What I try to do Hello Guys, I'm trying to create a Login-Screen which is connectet to my server. For this I created a Method which is in a other pakage than my Activity. I use this Method in my Activty and it works like a charme. Now the Problem sta

Does Threads in activity end when we start another?

I have an activity that starts 3 threads that make a "While(true)" loop when i start a new activity, does those threads terminate themselves? And another question, how do i start a new activity but i don't want to allow the 'back' button to retu

Design template for multithreaded task progress report

I have a library with an IJobMaker entity that creates a certain amount of IJob objects to be run on threads of their own managed by the user. To track each IJob's progress I implement the observer pattern with an IProgressObserver within every job.

Displaying the Toast message from a topic

My application launches a thread to query the web for some data. I want to display a Toast message when nothing is found, but my application always crashes. I've tried using the application Context from within the thread, like so: Toast.makeText(getA

For pthread, How to kill the child thread from the main thread

I use pthread_create to create several child threads. At a time, the main thread wants to kill all child threads or there will be segment falut. Which function should I use to finish that? I searched the answer from google and got function like pthre

can anyone help me understand this short .py

I'm trying to understand basic threading in python, I'm having trouble understanding how pooling works with the queue module. Heres the example server used in the howto I'm reading from:

How to find the CPU usage of a single thread in a process

I am looking a Tool on How to Find CPU Utilization of a Single Thread within a Process in VC++. It would be great full if any one could provide me a tool. Also it could be better if you guys provide how to do programmatically. Thank you in Advance.Pe