The following pthread code cannot compile, I want to know why. Can
somebody give me direction on this?
if I replace the following line of code
status1 = pthread_create( &threadID1, NULL, read, NULL);
with:
status1 = pthread_create( &threadID1, NULL, readerWriter::r ead, NULL);
It cannot compile either, how to make it to be compiled?
Thanks,
David
----------------cannot compile, want to know why-------
#include <pthread.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
class readerWriter{
public:
void *read(void *ptr);
void createThreads() ;
};
void *readerWriter:: read(void *ptr){
cout<<"read letter "<<endl;
return NULL;
}
void readerWriter::c reateThreads(){
pthread_t threadID1;
int status1;
//status1 = pthread_create( &threadID1, NULL, readerWriter::r ead,
NULL);
status1 = pthread_create( &threadID1, NULL, read, NULL);
status1 = pthread_join(th readID1, NULL);
}
int main(){
readerWriter rw;
rw.createThread s();
return 0;
}
Oct 7 '05
10 4972
Thanks a lot, red floyd. your suggestion is really helpful !!! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: lokb |
last post by:
Hi,
I am creating a detach thread as shown below and caling pthread_create in
a while loop where the file names in the directory are fetched and is
passed as a parmater to pthread create. The apilcation is running fine
except for the sleep cycle.
My sleep cylce is sleep(5) which is halting all the threads created from
execution. What i need here is the main thread creating the pthread should
only sleep but not all the threads created.
Is...
|
by: Lionel van den Berg |
last post by:
Hi all,
I'm having a problem porting from qt2.x to qt3.x. I have posted on a qt
forum but no joy as yet so I thought that maybe someone here could shed
some more light on what the compiler is doing. I have copied and pasted
my other post below.
*****
I'm just trying to compile some older code that used the qt libraries
but had a make file manually written for it and was being used on an
|
by: nan.li.g |
last post by:
Hello, all,
I have an interesting problem about stl map and pthread on Linux
and g++. The source code is as follows.
//mt_map_test.cpp
#include <string>
#include <map>
#include <unistd.h>
#include <sys/types.h>
|
by: szehau |
last post by:
Hi all,
I have a program written in C with embeded SQL. Following are the
configuration:
DB2/LINUX 8.1.5
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
My problems are as following
|
by: fran |
last post by:
Server: IBM XSERIES 225 (Intel Xeon CPU 2.40GHz 1GB RAM)
Operating System: Linux RedHat ES 2.1 kernel 2.4.9
Languaje: C++
Compiler: gcc 2.96
Libs: pthread
We are in need of your help in order to solve the folowing problem:
We´re working on a server side application that implements threads
(pthread under linux Red Hat ES 2.1 kernel 2.4.9). The problem seems
| |
by: chuckles |
last post by:
Hullo all, as the subject says Does pthread emit a sigchld signal on
successful exit?
I have an app which starts a thread in response to a button press in a
GUI. I can't join the thread but I need to know when it completes. The
time it takes for the thread to complete is variable and I don't want
to have to poll the thread for completion. I would like to avoid having
to use condition variables, so I thought setting up a signal handler to...
|
by: noleander |
last post by:
I've got an application that uses Pthread to do threading. Mostly Im using
Condition Variables and the associated function calls:
- pthread_cond_wait()
- pthread_cond_signal()
- pthread_cond_broadcast()
My boss says we cant use Pthread because of licensing issues (LGPL) .. we
can only use Native Win32 threading/mutex functions.
|
by: Louis B. (ldb) |
last post by:
I have a long running program that eventually crashes when valloc()
returns a 0. This program is relatively non-trivial as it's written in
Ada, is multithreaded, has alot of SSE routines. A memory leak would
be the most obvious cause but this appears to be more sinister then a
simple memory leak.
After alot of running around and searching through the code I found an
anomaly that I'd like to explain and understand if it's the cause of...
|
by: Akira Kitada |
last post by:
Hi,
I'm running Python 2.5 on FreeBSD 4.
pthread on FreeBSD 4 has some problems so I would like to build
python with lthread (linuxthreads) instead of BSD's pthread.
So I looked at configure options but couldn't find any options for it.
Python support lthread? and how can I build python with it?
Thanks in advance,
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |