Sponsored Content
Full Discussion: A simple C program query ...
Top Forums Programming A simple C program query ... Post 302569251 by agama on Sunday 30th of October 2011 11:30:16 AM
Old 10-30-2011
Is it possible that the lock should have already been captured and this code is just ensuring that it has the lock? In that context, the code is correct -- it's a bug if the lock wasn't obtained before invoking ext3_write_super.

If the lock is already held, then the return is 0, and thus it is safe to do the work that the function wants to do.

This might not be the case, but assuming you've posted the whole ext3_write_super function, which does not release the mutex, that'd be my guess.
 

10 More Discussions You Might Find Interesting

1. Programming

QUESTION...simple program?

I am new to the unix/linux environment. AND........ I need to create a mini shell..that displays prompt (i.e., READY:$), accepts a command from std-in, and prints the command and any parameters passed to it. HELP!!!! (8 Replies)
Discussion started by: jj1814
8 Replies

2. UNIX for Dummies Questions & Answers

simple sed query

hi, i would like to replace a string in a series of files with another string, without outputting to new files. is this possible? i've tried using sed, and started by trying to alter the contents of one file... sed 's/string1/string2/g' file.txt but while this does the replacement on... (2 Replies)
Discussion started by: schmark
2 Replies

3. UNIX for Dummies Questions & Answers

Simple loop query

Hi All Just started with shell scripts and am stumped by, what is to most of you no doubt, a simple issue. All I'm trying to do is prompt a user for input and writing to a log file. If the user types the word 'stop', then the program should halt. If the word typed is 'clear', then the log file... (2 Replies)
Discussion started by: kutz13
2 Replies

4. Shell Programming and Scripting

A simple query on unix shell script

I want to write a script to go to particular path in file and run shell script from there. what will be shell script for the same. (2 Replies)
Discussion started by: shekhar_ssm
2 Replies

5. Shell Programming and Scripting

pro*c program for sql query

Hi all, I have sql query as follows. Please write a pro*c program for the following query. select sp1.cost_change ||','|| sp1.cost_change_desc ||','|| sp1.reason ||','|| to_char(sp1.active_date,'DD-MON-YYYY HH24:MI:SS') ||','|| sp1.status ||','|| sp1.cost_change_origin... (0 Replies)
Discussion started by: user71408
0 Replies

6. Shell Programming and Scripting

Need Help !!! simple query

Dear, I have a alarm text file, containing minor and major alarms, i am intrested in Mojor alarm with its alarm header and next four lines in seperate file.... Can anybody help me with this below is the alarm file output. :SEV="MAJOR": Object-Instance % unit-type % bts nbr % 25 ... (5 Replies)
Discussion started by: Danish Shakil
5 Replies

7. Programming

Xlib simple program.

I don't know if it is right to ask you this. Can someone help me write a simple Xlib program,with button on it,and all that button do is switch 2 messages. I have tried and tried,but never get past Hello World. Can someone help me please? ---------- Post updated at 10:17 PM ---------- Previous... (2 Replies)
Discussion started by: megane16v
2 Replies

8. Shell Programming and Scripting

simple program help required

The circumfrence of a circle is #!/usr/bin/perl print 2 * 3.141592654 * 12.50 \n"; # pi= 3.141592654 # r= 12.50 I need a simple program showing me all the steps..to modify the above to prompt for and accept a radius from the person running the... (3 Replies)
Discussion started by: Q2wert
3 Replies

9. Shell Programming and Scripting

Help with simple program. (beginner)

Hey all, Writing a program that searches for a username and if they are online creates a 'beep' and sends the username and date to a log file. the error i am getting is: paul.obrien16@aisling:~/os$ bash checklogin : command not found Enter username paul.obrien16 ': not a valid... (2 Replies)
Discussion started by: sexyladywall
2 Replies

10. Shell Programming and Scripting

From perl program query is not executed.

I have tried executing one particular query through perl.But I am unable to get the result. When I tried to execute the sysdate query its working when I executed my perl code. The below query doesn't work. QUERY 1:my $sql ="select name from tab where rownum <6"; Received ora error... (23 Replies)
Discussion started by: ramkumar15
23 Replies
SPINLOCK(3)						   BSD Library Functions Manual 					       SPINLOCK(3)

NAME
OSSpinLockTry, OSSpinLockLock, OSSpinLockUnlock -- atomic spin lock synchronization primitives LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <libkern/OSAtomic.h> bool OSSpinLockTry(OSSpinLock *lock); void OSSpinLockLock(OSSpinLock *lock); void OSSpinLockUnlock(OSSpinLock *lock); DESCRIPTION
Spin locks are a simple, fast, thread-safe synchronization primitive that is suitable in situations where contention is expected to be low. The spinlock operations use memory barriers to synchronize access to shared memory protected by the lock. Preemption is possible while the lock is held. OSSpinLock is an integer type. The convention is that unlocked is zero, and locked is nonzero. Locks must be naturally aligned and cannot be in cache-inhibited memory. OSSpinLockLock() will spin if the lock is already held, but employs various strategies to back off, making it immune to most priority-inver- sion livelocks. But because it can spin, it may be inefficient in some situations. OSSpinLockTry() immediately returns false if the lock was held, true if it took the lock. It does not spin. OSSpinLockUnlock() unconditionally unlocks the lock by zeroing it. RETURN VALUES
OSSpinLockTry() returns true if it took the lock, false if the lock was already held. SEE ALSO
atomic(3), barrier(3) Darwin May 26, 2004 Darwin
All times are GMT -4. The time now is 01:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy