I am implementing a C++ message queue based on a std::queue.
As I need popers to wait on an empty queue I was considering using mutex for mutual exclusion and cond for suspending threads on empty queue, as glib does with the gasyncqueue.
However it looks to me that a mutex&semaphore would do the job, I think it contains an integer and ...
I am debugging an issue, where there is a thread which continues to run after the main thread has exited. It is stuck in a loop where it is waiting for another thread to change a variable.
I am trying to understand in what situations a process will continue running after the main thread has exited. I am using
32 bit linux
g++
pthreads...
If I set the CurrentCulture of a thread pool thread, what happens when the thread finishes execution and gets returned back to the thread pool? Does it get its CurrentCulture reset back to the default (whatever that may mean), or will it retain the culture I have set on it?
I'm hoping that the framework resets the thread to a default ...
I'm developing a thread safe class and I want to wrap async method call around a sync method call. Maybe I'm not looking for a definition of "asynccall" method, but something close to it. When calling AsyncToStartSearchPage() on the instance, I want the calling thread to block until the new thread obtains the lock on the object. That'...
I have an application, which need to do some validation on the database end. Each process goes through database validation (search on the table that has around 6 million records), then goes through some Lucene Index searcher (the index is built off this 6 million record table).
As these steps are disjoint for each line items being passe...
I understand that actors are a great feature and are the #1 choice for concurrency in scala, but I don't know if they would apply here.
I am creating an asynchronous server. Clients connect, send data, the server does a cpu intensive task, and then the client disconnects. There is no waiting for data - as soon as the client connects, it...
solved
I changed the bfs::directory_iterator Queue to a std::string queue, and surprisingly solved the problem.
Hi, I have a gut feeling that i'm doing things wrong.
I've implemented (or attempted to) the thread pool pattern.
N threads read from a Queue, but i'm having some trouble. Here's what i got:
//inside a while loop
bool isE...
Why is my Thread.Interrupt not working?
The code doing the interrupt:
public void Stop()
{
const string LOG_SOURCE = "ProcessingDriver";
if (_Enabled)
{
try
{
RequestProcessor.Disable();
if (ProcessingThread != null)
{
ProcessingThread.Interrupt();
...
I have these two pieces of code that could possibly be run at the same time on two different threads:
users = (from user in users
orderby user.IsLoggedIn descending ,
user.Username
select user).ToList();
and:
users=null;
The second piece of code will run on the main UI thread of the application. H...
I am learning Threads. I am using thread to process an array of integers and strings.
Example :
class Program
{
static void Main()
{
ArrayProcess pr=new ArrayProcess();
ThreadStart callback1 = new ThreadStart(pr.PrintNumbers);
ThreadStart callback2 = new ThreadStart(pr.PrintStrings);
callback1 += callback2;
...
Can someone give me a "simple" definition about Thread in android. I read the definition on the Android Site but It's really hard for me to imagine!
...
I have a fairly process intensive method that takes a given collection, copies the items(the Item class has its Copy() method properly defined), populates the item with data and returns the populated collection to the class's collection property
//populate Collection containing 40 items
MyClass.CollectionOfItems = GetPopulatedCollection...
I'm developing a multi-threaded ASP.NET 3.5 application, during working with some file, I'm getting the following exception :
The process cannot access the file
because it is being used by another
process
I'm looking for a way to know exactly which process is locking that file so I can stop its access to the file. OR if that i...
Hi,
We have a silverlight application which uses a dispatcher and I would appreciate any help explaining what the following codes does? (unfortunately the developer who wrote the code has left).
So what we have is the following:
Public Class ABC
{
private Dispatcher dispatcher;
private Thread threadRunner;
Public void ABC()
{
...
I've defined a class with a number of "observable" properties. Internally the class contains a single thread that performs I/O; e.g.
public class Foo {
private final PropertyChangeSupport support;
private State state;
public Foo() { this.support = new PropertyChangeSupport(this); }
public synchronized State getState() { retur...
We have a web-application that lets the users trigger a request to an external resource. The external resource spends an unspecified amount of time to gather results, so we have to poll it to get updates, and to collect the final results when they are done.
We wish to make it so that when the user triggers the request, it gets added to ...
Why does
HANDLE mutexHandle = INVALID_HANDLE_VALUE;
WaitForSingleObject(mutexHandle, INFINITE);
block? It does not return with an error message. Checking the handle for INVALID_HANDLE would be stupid for a mutex as I would need a mutex for accessing the mutex handle...
BTW: It does return with WAIT_FAILED if the handle was closed.
...
Can anyone recommend a "clean" way of closing a WCF service and its threads when hosted in a servicehost object?
Calling servicehost.Close(); doesn't work when the service has spawned other threads :/
Cheers,
Rob
...
Hi,
I´m using a class that encapsulates a thread_group, and have some questions about it
class MyGroup{
private:
boost::this_thread::id _id;
boost::thread::thread_group group;
int abc;
//other attributes
public:
void foo();
};
In the class constructor, i launch N threads
for (size_t i=0;i<N;i++){
g...
Hi guys, I'm looking for some help in finding some decent tutorials off the web to help supplement what I have learned in the book I am reading. If any of you guys got some tutorials that include UI Threading also, that would be brilliant ! UI Threading is not essential at the moment and so far the subject has been O.K but its not what I...