Briefly, a manual reset event is a synchronization construct which is either in the "signaled" or "nonsignaled" state. In the signaled state, any thread which calls a wait function on the event will not block and execution will continue unaffected. Any and all threads which calls a wait function on a nonsignaled object will block until...
Hi all,
I'm converting a Linux program to a Windows program using Visual Studio .NET 2003. The code was written using pthread.
I have a "First-chance exception at 0x100084c8 in project.exe: 0xC0000005: Access violation reading location 0x000001dc" error that is causing my program to crash, and all but one thread "has exited with code 0...
I have a pthreads program. I have to compile it with gcc -pthread in Linux (-pthreads is unrecognized option) and gcc -pthreads in Sun (-pthread is unrecognized option). Why the difference, since it's the same compiler? However, -lpthread works on both, but I heard this isn't always sufficient.
...
I'm running 2 threads ( assume they are pthreads for the moment) . Thread_1() makes a user-defined API call which ultimately does some work in the kernel . Thread_2() is totally in user-space.
My question is : Can Thread_2() start executing by pre-empting Thread_1() while the API call is in progress , the control is somewhere inside th...
Hi
Could someone please help me to compile my .c file with MSVC++6 in windows xp? From this morning, I am trying to compile it but it give me the following errors:
--------------------Configuration: server_th - Win32 Debug--------------------
Linking...
server_thread.obj : error LNK2001: unresolved external symbol _ThreadMain
Debug/se...
I have a question about variable scope and memory management in C. I am writing a program that listens for a socket connection and then launches a new thread to handle that client. The main while() loop can launch many separate threads. My question is this:
If I don't use dynamic memory allocation [no malloc()], and instead have a va...
I'm new to Python and seems that the multiprocessing and threads module are not very interesting and suffer from the same problems such as threads in Perl. Is there a technical reason why the interpreter can't use lightweight threads such as posix threads to make an efficient thread implementation that really runs on several cores?
...
I have written a simple multi-threaded C program to access MySQL,it works fine except when
i add usleep() or sleep() function in each thread function.
i created two pthreads in the main method,
int main(){
mysql_library_init(0,NULL,NULL);
printf("Hello world!\n");
init_pool(&p,100);
pthread_t producer;
...
The problem is that when I run the code below, on a single core, sometimes it runs correctly,and sometimes I get segmentation fault. Probably this problem will occure more frequently on a multi-core machine. I need to know where this non-determinism is introduces in my program and how can I resolve it.thanks.
int numThreads = 4;
class...
Is it possible by any means to change the limit on the number of pthreads a process can create ?
Currently on my linux system I can create around 380 threads but I want to increase that to say as long as memory is available.
...
Hi,
what the difference when the number of threads is determined, as e.g.:
for (i*10){
...
pthread_create(&thread[i], NULL, ThreadMain[i], (void *) xxx);
...
}
and when it is undetermined, just like this:
...
pthread_create(&threadID, NULL, ThreadMain, (void *) xxx);
...
In my case the numb...
What are the benefits of thread joining ? If the point is to join a thread to stop a thread A until thread B is finished executing, for instance (B.join()) why not use a global variable to do this?
...
I'm working on an embedded C++ application running on Linux. I've recently encountered some really strange performance problems with pthreads.
My system has 8 threads passing information back and forth protected using a pthread mutex lock. When running my application stand-alone, thread performance is abysmally slow when taking a mute...
How to include and where to find pthread.h for Visual Studio 2008?
...
I have the following test program.
#include <iostream>
#include <cstdlib>
using namespace std;
pthread_mutex_t mymutex = PTHREAD_MUTEX_INITIALIZER;
int main(int argc, char *argv[])
{
int iret;
iret = pthread_mutex_trylock( & mymutex );
cout << "Test2 !!! " << endl;
pthread_mutex_unlock( & mymutex );
return EXIT_SUCCESS;
...
[Edit: (copied from a comment) As it turns out, the problem was elsewhere, but thank you all for your input.]
I have a shared container class which uses a single mutex to lock the push() and pop() functions, since I don't want to simultaneously modify the head and tail. Here's the code:
int Queue::push( WorkUnit unit )
{
pthread_mu...
I have an image generator which would benefit from running in threads. I am intending to use POSIX threads, and have written some mock up code based on https://computing.llnl.gov/tutorials/pthreads/#ConVarSignal to test things out.
In the intended program, when the GUI is in use, I want the generated lines to appear from the top to the ...
A slow multiple precision implementation of a mandelbrot generator. Threaded, using POSIX threads. Gtk GUI.
I've got a bit lost. This is my first attempt at writing a threaded program. I'm not actually trying to convert the single-threaded version of it yet, just trying to implement the basic framework.
A brief description of how it wo...
What is the difference between semaphores and mutex provided by pthread library ?
...
In Cocoa, is NSThread faster than pthread? is are any performance gain? is it negligible to ignore?
...