when the control reaches function1(), it should get executed in the
background.At the same time main's printf(" ") statement should also get executed.i.e function1() should be independent of the main after it is called.Both should run simultaneously.
Also the background process should not return to main and handle other requests in background (e.g waiting for the msg Q to get filled up).
fork within the program to create a child process and execute the function1 inside the child process
and printf would resume with the parent process
you need to control regarding which should run first parent or child.
Hello all,
Can someone explain to me the advantage between using subshell over a function call in scripts? To me these are the same. Am I wrong to think this? (4 Replies)
Hi all,
I have a script like:
echo Please input list file name:
read listn
for file in `cat $listn.txt`
do
send_file $file
done
normally, I will run the script like:
:. resendfile
Please input list filename:
list1
#Then, the script will resend all file from the list1. However,... (4 Replies)
Hi,
I was trying to run ssh2 command in background... but i got follwoing error message saying that process has been stopped..
+ Stopped(SIGTTOU)
Anyone have any idea about this??? Appreciated your help.. (3 Replies)
Dear all,
I'm writing a KornShell script that calls inside it a function in background mode
#!/bin/ksh
function myfunction
{ . . .}
myfunction |&
. . .
How can I capture the PID of the function myfunction that runs in background?
Thanks in advance
:) (2 Replies)
Looking for a logic where say i have a script called parent_script which is used to call other 4 to 5 child scripts in background as..
cat parent_script # containing 65 lines
1
2
..
35 while read child_script
36 do
37 ./child_script_name&
38 done< ${SCRIPT_LISTS}
39
40 # Need to have... (2 Replies)
Hello everybody,
I'm making a script for running a .bat process on wineconsole, but I want that wineconsole doesn't show up when I call it from the script.
The script is named "reset" and it looks like this:
When I execute it, it will show up the wineconsole window on top, and that is... (3 Replies)
Hii Friends,
I am using Perl CGI. I am running A SCP Command via Perl CGI in Background. Like
system("scp -r machinename:/PathOfFile/ /Path/WhereToCopyIt/ &)
This Copy Process takes some times lets say 15 min.
Now I want When This copy process gets complete then send me... (5 Replies)
Here is some back ground on the script. The script is to poll an arbitrary number of DB's. To do this I am creating a function that takes the file_path to the DB and the min poll interval as arguments. The function will be called for each DB and then ran in the background. The function I was... (6 Replies)
Discussion started by: ryandavison
6 Replies
LEARN ABOUT OPENDARWIN
bgerror
bgerror(n) Tcl Built-In Commands bgerror(n)
__________________________________________________________________________________________________________________________________________________NAME
bgerror - Command invoked to process background errors
SYNOPSIS
bgerror message
_________________________________________________________________DESCRIPTION
The bgerror command doesn't exist as built-in part of Tcl. Instead, individual applications or users can define a bgerror command (e.g. as
a Tcl procedure) if they wish to handle background errors.
A background error is one that occurs in an event handler or some other command that didn't originate with the application. For example,
if an error occurs while executing a command specified with the after command, then it is a background error. For a non-background error,
the error can simply be returned up through nested Tcl command evaluations until it reaches the top-level code in the application; then the
application can report the error in whatever way it wishes. When a background error occurs, the unwinding ends in the Tcl library and
there is no obvious way for Tcl to report the error.
When Tcl detects a background error, it saves information about the error and invokes the bgerror command later as an idle event handler.
Before invoking bgerror, Tcl restores the errorInfo and errorCode variables to their values at the time the error occurred, then it invokes
bgerror with the error message as its only argument. Tcl assumes that the application has implemented the bgerror command, and that the
command will report the error in a way that makes sense for the application. Tcl will ignore any result returned by the bgerror command as
long as no error is generated.
If another Tcl error occurs within the bgerror command (for example, because no bgerror command has been defined) then Tcl reports the
error itself by writing a message to stderr.
If several background errors accumulate before bgerror is invoked to process them, bgerror will be invoked once for each error, in the
order they occurred. However, if bgerror returns with a break exception, then any remaining errors are skipped without calling bgerror.
Tcl has no default implementation for bgerror. However, in applications using Tk there is a default bgerror procedure which posts a dialog
box containing the error message and offers the user a chance to see a stack trace showing where the error occurred. In addition to allow-
ing the user to view the stack trace, the dialog provides an additional application configurable button which may be used, for example, to
save the stack trace to a file. By default, this is the behavior associated with that button. This behavior can be redefined by setting
the option database values *ErrorDialog.function.text, to specify the caption for the function button, and *ErrorDialog.function.command,
to specify the command to be run. The text of the stack trace is appended to the command when it is evaluated. If either of these options
is set to the empty string, then the additional button will not be displayed in the dialog.
SEE ALSO
after(n), tclvars(n)
KEYWORDS
background error, reporting
Tcl 7.5 bgerror(n)