12-23-2007
The waiting is the hardest part
So, I'm looking at WaitFor.c in the xorg-server/os source files. I see where it selects it's clients, but I don't see where it selects anything triggered off of a clock. I also see time() checks in the source, but it looks like the piece is the screen saver manager.
I also found selects in hw/xfree86/common/xf86Events.c, but that looks like stuff used to wake up from the screen saver.
I haven't found what I'm looking for yet. What I'm trying to find is a, hopefully very platform independent way of executing a function at regular intervals, without using a sleep anywhere in the program. Something like JavaScripts setTimeout() and setInterval(). And, it's got to be thread safe.
I'm sure the x server does this, but I don't know exactly where to look.
Any tips?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I wrote a smiple ksh function
send_notification() {
...
}
and want to execute it on each file, matched by the find command.
I tried:
find / -name "*.err" -mtime -8 -exec send_notification {} \;
but it doesn't work. What should I do? I work in ksh on Hp-Ux.
Regards,
Pit (11 Replies)
Discussion started by: piooooter
11 Replies
2. Shell Programming and Scripting
Hi All,
Can you please tell me how to execute local function written in a shell script with awk.
i tried with system command but its giving an error. (1 Reply)
Discussion started by: krishna_gnv
1 Replies
3. UNIX for Advanced & Expert Users
I have a script A which calls script B. I wrote a function in script A to be executed when Kill command is issued for script A and I invoke that function using the trap command.The function identifies all child process running under script A (in this case script B) and kills the child process and... (3 Replies)
Discussion started by: smohandass
3 Replies
4. Shell Programming and Scripting
Gurus,
Can you please tell me why this script is executing but i am getting no result...also can you tell me what is this gettime() doing?
in a script i wrote this hour.SH
--------------------------
gettime() {
date '+%H' | {
read hour
TIME=${hour}
}
}
:
----------------------... (2 Replies)
Discussion started by: RubinPat
2 Replies
5. UNIX for Dummies Questions & Answers
dear all
i need your advice in shell with solaris
i have testing script like this
#!/usr/bin/bash
function test(){
echo "testing only"
}
## execute function ##
test
but if i running always got error like this
test.sh: syntax error at line 1: `(' unexpected
who can i running this... (7 Replies)
Discussion started by: zvtral
7 Replies
6. Shell Programming and Scripting
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
7. Shell Programming and Scripting
Hi
I am trying to a write a script which gives message queue depth for every 5 mins in a file.
Commands that I use are
runmqsc QM_Name
display ql(*) curdepth
Since I can use only MQSC commands I need help on how to fetch the output on to a file after executing display command. (3 Replies)
Discussion started by: jhilmil
3 Replies
8. Shell Programming and Scripting
#!/bin/bash
function getDeliveredDispatches(firstDateTime, lastDateTime, limit) {
var cursor = db.dispatches.find(
{$and: }}
]},
{"deliveryGroupId" : 1, "batchId": 1, "statusHistory.code" : 1}
);
var wrongDispatchesIds = ;
print("Number of dispatches selected based on filter = " +... (2 Replies)
Discussion started by: neel2462
2 Replies
9. Shell Programming and Scripting
Hi,
I am new to shell scripting and i need to write a automation script to execute sql files. I need to check the table if it is there in system tables and need to write a function to call the .sql files.
For ex. I have a.sql,b.sql,c.sql files, where the sql file contains DELETE and INSERT... (1 Reply)
Discussion started by: Samah
1 Replies
10. Shell Programming and Scripting
Hi All,
I have a menu driven scripts. As you know while running the script we have to input the option such as 1,2, and 3 to execute function accordingly. but after selecting the input we have to press Enter.
My requirement is to execute function as soon as we press the option.
Is there... (5 Replies)
Discussion started by: kiran_j
5 Replies
LEARN ABOUT XFREE86
xforcescreensaver
XSetScreenSaver(3X11) XLIB FUNCTIONS XSetScreenSaver(3X11)
NAME
XSetScreenSaver, XForceScreenSaver, XActivateScreenSaver, XResetScreenSaver, XGetScreenSaver - manipulate the screen saver
SYNTAX
int XSetScreenSaver(Display *display, int timeout, int interval, int prefer_blanking, int allow_exposures);
int XForceScreenSaver(Display *display, int mode);
int XActivateScreenSaver(Display *display);
int XResetScreenSaver(Display *display);
int XGetScreenSaver(Display *display, int *timeout_return, int *interval_return, int *prefer_blanking_return, int *allow_exposures_return);
ARGUMENTS
allow_exposures
Specifies the screen save control values. You can pass DontAllowExposures, AllowExposures, or DefaultExposures.
allow_exposures_return
Returns the current screen save control value (DontAllowExposures, AllowExposures, or DefaultExposures).
display Specifies the connection to the X server.
interval Specifies the interval, in seconds, between screen saver alterations.
interval_return
Returns the interval between screen saver invocations.
mode Specifies the mode that is to be applied. You can pass ScreenSaverActive or ScreenSaverReset.
prefer_blanking
Specifies how to enable screen blanking. You can pass DontPreferBlanking, PreferBlanking, or DefaultBlanking.
prefer_blanking_return
Returns the current screen blanking preference (DontPreferBlanking, PreferBlanking, or DefaultBlanking).
timeout Specifies the timeout, in seconds, until the screen saver turns on.
timeout_return
Returns the timeout, in seconds, until the screen saver turns on.
DESCRIPTION
Timeout and interval are specified in seconds. A timeout of 0 disables the screen saver (but an activated screen saver is not deacti-
vated), and a timeout of -1 restores the default. Other negative values generate a BadValue error. If the timeout value is nonzero,
XSetScreenSaver enables the screen saver. An interval of 0 disables the random-pattern motion. If no input from devices (keyboard, mouse,
and so on) is generated for the specified number of timeout seconds once the screen saver is enabled, the screen saver is activated.
For each screen, if blanking is preferred and the hardware supports video blanking, the screen simply goes blank. Otherwise, if either
exposures are allowed or the screen can be regenerated without sending Expose events to clients, the screen is tiled with the root window
background tile randomly re-origined each interval seconds. Otherwise, the screens' state do not change, and the screen saver is not acti-
vated. The screen saver is deactivated, and all screen states are restored at the next keyboard or pointer input or at the next call to
XForceScreenSaver with mode ScreenSaverReset.
If the server-dependent screen saver method supports periodic change, the interval argument serves as a hint about how long the change
period should be, and zero hints that no periodic change should be made. Examples of ways to change the screen include scrambling the col-
ormap periodically, moving an icon image around the screen periodically, or tiling the screen with the root window background tile, ran-
domly re-origined periodically.
XSetScreenSaver can generate a BadValue error.
If the specified mode is ScreenSaverActive and the screen saver currently is deactivated, XForceScreenSaver activates the screen saver even
if the screen saver had been disabled with a timeout of zero. If the specified mode is ScreenSaverReset and the screen saver currently is
enabled, XForceScreenSaver deactivates the screen saver if it was activated, and the activation timer is reset to its initial state (as if
device input had been received).
XForceScreenSaver can generate a BadValue error.
The XActivateScreenSaver function activates the screen saver.
The XResetScreenSaver function resets the screen saver.
The XGetScreenSaver function gets the current screen saver values.
DIAGNOSTICS
BadValue Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argu-
ment, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this
error.
SEE ALSO
Xlib - C Language X Interface
XFree86 Version 4.7.0 XSetScreenSaver(3X11)