Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ftrylockfile(3s) [hpux man page]

flockfile(3S)															     flockfile(3S)

NAME
flockfile(), ftrylockfile(), funlockfile() - explicit locking of streams within a multithread application SYNOPSIS
DESCRIPTION
The and functions provide for explicit application-level locking of streams. These functions can be used by a thread to delineate a sequence of I/O statements that are to be executed as a unit. The function is used by a thread to acquire ownership of a object. The function is used by a thread to acquire ownership of a object if the object is available; is a non-blocking version of The function is used to relinquish the ownership granted to the thread. The behavior is undefined if a thread other than the current owner calls the function. Logically, there is a count associated with each stream. This count is implicitly initialized to zero when the stream is created. The stream is unlocked when the count is zero. When the count is positive, a single thread owns the stream. When the function is called, if the count is zero or if the count is positive and the caller owns the stream, the count is incremented. Otherwise, the calling thread is suspended, waiting for the count to return to zero. Each call to decrements the count. This allows matching calls to (or successful calls to and to be nested. All POSIX.1 and C standard functions that reference objects behave as if they use and internally to obtain ownership of these objects. RETURN VALUE
None for and The function returns zero for success and nonzero to indicate that the lock cannot be acquired. flockfile(3S)

Check Out this Related Man Page

flockfile(3S)															     flockfile(3S)

NAME
flockfile(), ftrylockfile(), funlockfile() - explicit locking of streams within a multithread application SYNOPSIS
DESCRIPTION
The and functions provide for explicit application-level locking of streams. These functions can be used by a thread to delineate a sequence of I/O statements that are to be executed as a unit. The function is used by a thread to acquire ownership of a object. The function is used by a thread to acquire ownership of a object if the object is available; is a non-blocking version of The function is used to relinquish the ownership granted to the thread. The behavior is undefined if a thread other than the current owner calls the function. Logically, there is a count associated with each stream. This count is implicitly initialized to zero when the stream is created. The stream is unlocked when the count is zero. When the count is positive, a single thread owns the stream. When the function is called, if the count is zero or if the count is positive and the caller owns the stream, the count is incremented. Otherwise, the calling thread is suspended, waiting for the count to return to zero. Each call to decrements the count. This allows matching calls to (or successful calls to and to be nested. All POSIX.1 and C standard functions that reference objects behave as if they use and internally to obtain ownership of these objects. RETURN VALUE
None for and The function returns zero for success and nonzero to indicate that the lock cannot be acquired. flockfile(3S)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script Variables

HI guys I need to store the output of a sql query in a variable, can you tell me how to do that eg) select count(*) from s_escl_req $count = count(*) from s_escl_req how would i store the count(*) from the sql statement in a variable called $count. thanks (3 Replies)
Discussion started by: ragha81
3 Replies

2. UNIX for Dummies Questions & Answers

100% ownership to files

ok. this is a bit complicated. i have a manager here who wants me to give another user access to all the files he owns. he wants this other user to have the same rights has he does. the problem has been that whenever the manager creates a new file the permissions on the files created... (3 Replies)
Discussion started by: Terrible
3 Replies

3. Shell Programming and Scripting

Number count per number ranges

Hi, I have a question here that need to get advise from all of you. Let say I have a set of data 12347777 12359899 12347677 12360090 12347688 12359979 12359009 12367022 12346677 I need to count the number that appear in each numbering ranges and the output is like below: Prefix ... (5 Replies)
Discussion started by: shirleyeow
5 Replies

4. Shell Programming and Scripting

Get count on different fields along the raws in a file

Dear All, Please help me to do this. I have a file like this. 5|94662240807|94776109911|94776325901|94779007172|||||| 5|94112925421|94352240384|94352259199|94672229012|||||| 5|94714242745|94722952461|94777660793|94788914465|||||| 5|94242224624|94776145420|94776172499|94776531059|||||| ... (7 Replies)
Discussion started by: Nayanajith
7 Replies

5. UNIX for Dummies Questions & Answers

Sorting using count, grep and count

Hi, I trying to sort information in a file by making count for every object. For example: A B A D A B C i would like to sort out count for each object (A's, B's and etc) but in actual case i dont know the object but i know the position ofthe object. do i need to use array as well? Any... (2 Replies)
Discussion started by: sukhpal_78
2 Replies

6. UNIX for Dummies Questions & Answers

count amount of accounts?

Hi, I am relatively new to Unix and trying to understand as much as I can. I would like to know if it's possible to count the total number of Unix accounts? If so, can the count be done from any working directory or does it have to be specific to where the accounts are based? Thanks! (4 Replies)
Discussion started by: Trogan
4 Replies

7. Shell Programming and Scripting

Awk-Group count of field

Hi, Suppose if i am having a file with following records as given below. 5555 6756 5555 4555 4555 6767 how can i get the count of each record using AWK. Eg:5555 count should be 2 4555 count should be 2 6767 count should be 1 ... (5 Replies)
Discussion started by: tinivt
5 Replies

8. UNIX for Dummies Questions & Answers

counting in unix

my script: count=0while test $count -lt 10do#do something for 0,1,2...9 count=$(($count+1))doneIt doesnt work. Can anyone tell me what im doing wrong?? thanks (11 Replies)
Discussion started by: JamieMurry
11 Replies

9. UNIX for Dummies Questions & Answers

What is the need of ownership to a file/dir?

Hi, I understand the permissions of a file/directory. I just needs to understand how ownership works. Can some one help me on this please? Thanks in advance. (6 Replies)
Discussion started by: praveen_b744
6 Replies

10. Solaris

How to find an application running on multithread?

Dear Friends, We have one T5240 server with 128vcpus in our lab.Performance of the server is very poor. Application uses only 2% of processor..I heard that single thread application performs slowly in coolthread.How can we find whether the application running on multithread or single thread? If... (7 Replies)
Discussion started by: nicktrix
7 Replies

11. UNIX for Advanced & Expert Users

Implementing thread in UNIX

Hi For our load testing , we are using stubs (unix shell script) which send the response to the request coming from the application. As the unix stub is single threaded , it is responding to only one request whereas multiple requests come in parallely. I haven't worked on thread concepts... (5 Replies)
Discussion started by: jenanee
5 Replies

12. Shell Programming and Scripting

I am having trouble with this count script

I have to display the file name followed by the line count then work count. I am able to display it in the opposite order, but can figure out how to switch it. Can anyone help me with this it would be greatly appreciated. My code is as follows: #!/bin/bash # #Conts and displays the... (5 Replies)
Discussion started by: football12345
5 Replies

13. Shell Programming and Scripting

Getting Error count

Hi All, I have the below code. After doing copy and move if there is an error that should be initially captured as 1 and incremented for each error with exiting. Finally if the total error count to be greater than 2 then I need to exit the script. ######################## cp a/x.csv... (2 Replies)
Discussion started by: weknowd
2 Replies

14. Programming

SQL*PLUS How to display a count of 0

Hi, I have been frantically googling and checking some sqlplus forums, but can't find the correct syntax. Basically within sqlplus I want to do a count on a table and if the count is 0 it displays 0 instead of "no rows found". For eample: select count(*) from tableA where... (3 Replies)
Discussion started by: chris01010
3 Replies

15. Shell Programming and Scripting

Errors running perl statement

When I run this #!/bin/bash Block count: 421958912 Reserved block count: 4219589 perl -e "printf(\"%.1lf%%\n\", ($Reserved block count * 100.0 ) / $Block count);" I get these error messages. Can someone please help me? andyk_~/Downloads$ Show_Percent_Reserved_Blocks.sh... (4 Replies)
Discussion started by: drew77
4 Replies