473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem in Runing Threads in C (solaris)

I have made the following program, but the thread is not running. Output says thread created but the thread function (which i want to call so as to perform the deletion of file from a path) is not called. neither it has displayed "Hello" as output. Please let me know how to run the thread function "am".



#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void* am(void* myID)
{
printf(" Hello : ");
system("rm /home/user/download/hero.txt");
}
int main(){
pthread_attr_t attr;
pthread_t tid;
int status;
int i;
status=pthread_create(&tid,NULL,am,(void*)1);
if (status) {
printf("\n Error Initialization ");
}
status=pthread_attr_init(&attr);
if (status) {
printf("\n Error Creating thread ");
}
else
{
printf("\n Thread Created");
}
pthread_join(tid,NULL);
i++;
}


Output:
Error Initialization
Thread Created
Apr 28 '06 #1
0 1719

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Tzach | last post by:
I'm developing a simple Java client that runs over a CORBA server. The main client thread is waiting for notification from this server. On each notification, The client creates a new thread...
0
by: Dave Harrison | last post by:
Ok before I start, please dont mail me telling me to use a more recent version of Python, I _would_ use 2.2.x but due to an existing framework all based on using 2.1.1 I have been specifically told...
0
by: Holger Joukl | last post by:
Hi there, I have severe problems running python 1.5.2 (yes I know, but this is a productive environment; cannot switch to py 2.3.3 until later this year...) on several multi-processor sun...
2
by: Holger Joukl | last post by:
Hi, migrating from good old python 1.5.2 to python 2.3, I have a problem running a program that features some threads which execute calls to an extension module. Problem is that all of a sudden,...
1
by: Christian Eriksson | last post by:
Hi! I have a problem using the environment variable LD_LIBRARY_PATH in my perl script. Everything works fine when I set it at the command prompt and then runs my perl script like this: ...
6
by: Evan David Light | last post by:
After agonizing over this problem for a few days, I've decided to seek help. No, not the variety that involes a jacket that zips up the back but this august body of intrepid individuals. I've...
2
by: Sarath | last post by:
Hi, I want to know whether ther is any probability of implementing threads using C language in Solaris environment Thankx Sarath
4
by: sunilkher | last post by:
Here is a small sample program that I have. #include <stdlib.h> #include <pthread.h> #include <string> using namespace std; pthread_t threads; pthread_attr_t thr_attr;
1
by: is_vlb50 | last post by:
I have problem with pass structure to thread function in SOLARIS.When I pass it to created thread it always has empty values. my structure defined as: typedef struct momMSG{ struct mbhdr hd;...
7
by: Alexander Kotelnikov | last post by:
Hello. I faced the same problem which arose before Message-ID: <1124162913.832263.262410@g14g2000cwa.googlegroups.com>...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.