Visit Our UNIX and Linux User Community


pthread_mutex_timedlock and Timers option


 
Thread Tools Search this Thread
Top Forums Programming pthread_mutex_timedlock and Timers option
# 1  
Old 09-27-2010
pthread_mutex_timedlock and Timers option

in its man-page pthread_mutex_timedlock documents that the absolute timeout parameter should be based on the CLOCK_REALTIME clock or in the system clock. All this depending on whether the 'Timers option' is supported or not.

What do they mean by 'Timers option'? How could I tell for sure what time getter API should I use in my specific platform?

thanks,
Rodrigo
# 2  
Old 09-27-2010
See man clock_gettime.
# 3  
Old 09-27-2010
but that does not help me understand the statement in the pthread_mutex_timedlock man-page. All the examples I have seen around they use clock_gettime with option CLOCK_REALTIME before calling pthread_mutex_timedlock. But this did not work on my platform and what did work was to get the time by means of gettimeofday, convert to timespec and then call pthread_mutex_timedlock.

okay, I did not want to go into the details of my test, because I'm sure this will drive the discussion away from my basic question. How can I tell that in my platform the 'Timers option' (as in pthread_mutex_timedlock's man-page) is available or not?
# 4  
Old 09-27-2010
In what manner did it 'not work' on your platform? runtime error? link error? compiler error? If it's just a runtime error, the obvious way would be to try it and see if it's available.
# 5  
Old 09-27-2010
run time misbehavior. it did timeout much before the absolute time passed as parameter.

ps: something strange here. in my browser I read that your first reply says 'clock_gettime', but in the notification I got via email it says 'clock_getres'.
# 6  
Old 09-27-2010
Quote:
Originally Posted by ramestica
run time misbehavior. it did timeout much before the absolute time passed as parameter.
Ah, so it's not unavailable as much as just not working correctly. To see what's going on I'd need to see the code.
Quote:
ps: something strange here. in my browser I read that your first reply says 'clock_gettime', but in the notification I got via email it says 'clock_getres'.
A mistake on my part. I frequently edit my posts.
# 7  
Old 09-27-2010
The term "Timers option" comes from the IEEE Std 1003.1-2004 (The Open Group Base Specifications, Issue 6) standard which was superceeded by IEEE Std 1003.1-2008 (The Open Group Base Specifications Issue 7).

See IEEE Std 1003.1-2004 XBD (Base Definitions) section 1.51 Codes for exact details. Essentially the "Time Options" consisted of optional POSIX.1b (Realtime extension) functionality denoted by the margin notation "[TMR]".

In this particular specification, clock_getres(), clock_gettime(), clock_settime() and more were denoted by [TMR] - hence the appropriate verbiage in the pthread_mutex_timedlock() man page.

Previous Thread | Next Thread
Test Your Knowledge in Computers #385
Difficulty: Easy
The Linux uptime command show how long the hard drive has been powered down.
True or False?

10 More Discussions You Might Find Interesting

1. Solaris

Unrecognized option: sparc-sun-Solaris2.10/bin/as: unrecognized option `-m32'

Hi, I installed some packages required by an app built with python. But when I try python setup.py install, I get the following error: /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.2.0/../../../../sparc-sun-solaris2.10/bin/as: unrecognized option `-m32' Could anyone tell me what's wrong... (4 Replies)
Discussion started by: Kimkun
4 Replies

2. Shell Programming and Scripting

-f option and -rf in rm

Hi, I'm new to shell scripting and I'm trying to read some code I need to use. Could you help me out on what it's doing? I read this as.... if the directory has files then rm all the files in that directory. I'm not sure.... if ; then run "rm -rf ${TSP_FILEPATH_PLUGIN_DIR}"; fi run... (8 Replies)
Discussion started by: jdilts
8 Replies

3. Shell Programming and Scripting

A Question Regarding Timers and Output

Hi there. I am fairly new to scripting in BASH so please forgive my clumsy syntax and analogy as I try to explain what I am trying to accomplish. I have a list of mundane functions that I currently call from a script file. What I wish to do is to accurately record into a log file the times that... (17 Replies)
Discussion started by: Tenuous
17 Replies

4. Shell Programming and Scripting

recently introduced to the newer option for find...does an older option exist?

To find all the files in your home directory that have been edited in some way since the last tar file, use this command: find . -newer backup.tar.gz Is anyone familiar with an older solution? looking to identify files older then 15mins across several directories. thanks, manny (2 Replies)
Discussion started by: mr_manny
2 Replies

5. Programming

Doubts about timers in linux kernel

Hi , I am trying to learn timers in linux kernel. I am trying to write a program where I can configure a timer to tick in every 5 seconds and a function should thus exicute in every five seconds. I tried one program with the help of linux/timer.h headerfile but I couldnt get the... (4 Replies)
Discussion started by: iamjayanth
4 Replies

6. Shell Programming and Scripting

option followed by : taking next option if argument missing with getopts

Hi all, I am parsing command line options using getopts. The problem is that mandatory argument options following ":" is taking next option as argument if it is not followed by any argument. Below is the script: while getopts :hd:t:s:l:p:f: opt do case "$opt" in -h|-\?)... (2 Replies)
Discussion started by: gurukottur
2 Replies

7. Programming

cc option

my yacc output file y.tab.c is not compiling using cc y.tab.c -ly command .possibily option flag -ly is not correct.i m using red hat linux 9.please give solutions. (4 Replies)
Discussion started by: kuldeep_bora
4 Replies

8. UNIX for Advanced & Expert Users

su option

We have started to us the su option on our production server. We log in with our own id and then su into a special id to perform various tasks. This allows our actions to be monitored. I need to know how to use the su option when doing an ftp between two servers. I noticed that when I log into... (1 Reply)
Discussion started by: lesstjm
1 Replies

9. UNIX for Advanced & Expert Users

-h option

Hi what does the following mean in shell scripts (-h option) val contains a string. while (-h "$val") (1 Reply)
Discussion started by: Raom
1 Replies

10. Programming

unix and timers

Hello there.. I need to know when i start indipendant timers how can i recognize which of the active timers have made timeout alarm. The number of started timers depends on the running app I'd appreciate your help Thanks in advance (0 Replies)
Discussion started by: nightcat
0 Replies

Featured Tech Videos