Sponsored Content
Full Discussion: forking within a thread
Top Forums Programming forking within a thread Post 302124465 by axes on Sunday 1st of July 2007 04:24:33 AM
Old 07-01-2007
forking within a thread

Is it safe to call fork+exec in a multithreaded application.

Because In my multithreaded application, I need to execute another program in each thread.

I am using solaris 10.

Any suggestions pls.
axes
 

10 More Discussions You Might Find Interesting

1. Programming

Forking in a loop

When I compile this C programme I get different outputs each time I run it Please explain to me whats happening in the code if you can give me a detailed explanation. Because I am stuck with this. #include <stdio.h> main(){ int i = 0; printf("I am the... (1 Reply)
Discussion started by: manjuWicky
1 Replies

2. UNIX for Advanced & Expert Users

Forking

When I compile this C programme I get different outputs each time I run it Please explain to me whats happening in the code if you can give me a detailed explanation with the schedular functionality it will help a lot. Because I am stuck with this. #include <stdio.h> main(){... (3 Replies)
Discussion started by: manjuWicky
3 Replies

3. Programming

forking a new process

Hi I'm currently working with C on UNIX (HPUX) and need to be able to fork a seperate Java process from within a running C process. I can run the following code from the command line via a script but am having difficulty getting it to work from within the code. I am trying to use execl. Is... (4 Replies)
Discussion started by: themezzaman
4 Replies

4. Programming

forking process.

#include <stdio.h> #include <sys/types.h> #include <unistd.h> int main() { pid_t pID; int i; for (i = 0; i < 3; i++) { pID = fork (); if (pID == 0) { printf ("Value of i --> %d... (2 Replies)
Discussion started by: kymthasneem
2 Replies

5. Shell Programming and Scripting

Forking with Tclsh vs Wish

Hello, I am new to this site, so sorry ahead of time if this is not the right place for this question.......anywhooooo I am having troubles with forking new processes in wish. Take the following code example: **************************** package require Tclx puts "TCL VER: " proc... (3 Replies)
Discussion started by: pghamami
3 Replies

6. Programming

Forking in Unix using C++

i wanna ask about forking in unix...how can you do forking...??i don't understand and i have an assignment about it...the output should look like this... Question 1 : what's your name ? Answer : if no answer, write to file...----Out of time-----because for each question it is given a... (3 Replies)
Discussion started by: kkk02
3 Replies

7. Shell Programming and Scripting

Problem with forking

Hi, my $log = IO::File->new(">$log_file_name"); $log->print("date()."--\n\n\n"); sub process { my ($sub_dir, $file, $config, $log) = @_; $log->print("-- Reading $file file\n"); } my $pm = new Parallel::ForkManager($tc+1); $pm->run_on_finish( sub { my ($pid, $exit_code,... (1 Reply)
Discussion started by: sandy1028
1 Replies

8. Shell Programming and Scripting

Forking and Pinging

Keep in mind that I haven't done Perl scripting for a LONG time, so I'm quite rusty. This is what I would like to do: - using fork, create 3 or 4 processes to read 3 or 4 different text documents containing server names or IP addresses - in each of those processes, Perl will ping each of those... (7 Replies)
Discussion started by: kooshi
7 Replies

9. Programming

Parent forking

My question is, how do you fork only the parent processes in unix? For example how would I use the fork function to fork the parent process more than once and leave the children processes alone. This way I do not have children of children. The way I have it set up now it the parent process forks 3... (7 Replies)
Discussion started by: TWhitt24
7 Replies

10. Programming

need help in forking

I have an input file with contents like: 5785690|68690|898809 7960789|89709|789789 7669900|87865|659708 7869098|65769|347658 so on.. I need to pass this file to 10 parallely running processes (forking)so that each line is processed by a process and no line is processed twice and write the... (1 Reply)
Discussion started by: rkrish
1 Replies
getrpcent(3C)															     getrpcent(3C)

NAME
getrpcent(), getrpcbyname(), getrpcbynumber(), setrpcent(), endrpcent() - get RPC entry SYNOPSIS
[ flag ]... file ... [ library ]... DESCRIPTION
These functions are used to obtain entries for RPC (Remote Procedure Call) services. An entry may come from any of the sources for speci- fied in the file (see nsswitch.conf(4)). searches for an entry with the RPC service name specified by the parameter name. searches for an entry with the RPC program number number. The functions and are used to enumerate RPC entries from the database. sets (or resets) the enumeration to the beginning of the set of RPC entries. This function should be called before the first call to Calls to and leave the enumeration position in an indeterminate state. If the stayopen flag is non-zero, the system may keep allocated resources such as open file descriptors until a subsequent call to Successive calls to return either successive entries or NULL, indicating the end of the enumeration. may be called to indicate that the caller expects to do no further RPC entry retrieval operations; the system may then deallocate resources it was using. It is still allowed, but possibly less efficient, for the process to call more RPC entry retrieval functions after calling MULTITHREAD USAGE
Thread Safe: Yes Cancel Safe: Yes Fork Safe: No Async-cancel Safe: No Async-signal Safe: No These functions can be called safely in a multithreaded environment. They may be cancellation points in that they call functions that are cancel points. In a multithreaded environment, these functions are not safe to be called by a child process after and before These functions should not be called by a multithreaded application that supports asynchronous cancellation or asynchronous signals. and use thread specific storage that is re-used in each call. The return value, should be unique for each thread and should be saved, if desired, before the thread makes the next call. For enumeration in multithreaded applications, the position within the enumeration is a process-wide property shared by all threads. may be used in a multithreaded application but resets the enumeration position for all threads. If multiple threads interleave calls to the threads will enumerate disjoint subsets of the RPC entry database. RETURN VALUE
RPC entries are represented by the structure defined in The functions and each return a pointer to a if they successfully locate the requested entry; otherwise they return NULL. The function returns a pointer to a if it successfully enumerates an entry; otherwise it returns NULL, indicating the end of the enumera- tion. WARNINGS
Programs that use the interfaces described in this manual page cannot be linked statically since the implementations of these functions employ dynamic loading and linking of shared objects at run time. AUTHOR
was developed by Sun Microsystems, Inc. FILES
SEE ALSO
rpcinfo(1M), rpc(4), nsswitch.conf(4). getrpcent(3C)
All times are GMT -4. The time now is 02:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy