LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-25-2003, 11:20 PM   #1
marry_jeo
LQ Newbie
 
Registered: Feb 2003
Posts: 1

Rep: Reputation: 0
semaphore init problem in linux


Hello all,
I m using sem_init() in my program. when i call this
function as

sem_t *pSem = (sem_t*)malloc(sizeof(sem_t));
sem_init(pSem, 0, 1);

it sets the values of pSem as
pSem
__sem_lock
__status 0
__spinlock 0
__sem_value 1
__sem_waiting
the value of __sem_value is 1, means only one can
enter after sem_wait() at a time.

but when make a library of this function, and then call this funciton in my application. it sets as
__sem_lock
__status 3
__spinlock 0
__sem_value 0
__sem_waiting

the value of __sem_value is zero, therefore it does
not allow anyone to enter after sem_wait().

I dont know why it is happening.
Can anyone help me plz and get rid of this problem.

Thnx & Rgds,
Marry
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel Compile problem (FC 3, 2.6.11.6 -> 2.6.13.3, semaphore.c) U4ea Linux - Software 1 10-07-2005 03:29 AM
shared memory/semaphore problem V_Ganesh Programming 1 03-31-2005 10:58 PM
Driver Development - Semaphore problem! Help please! 7.e.Q Programming 1 11-10-2004 10:57 PM
Linux kernel module programming(Signal and semaphore) eshwar_ind Programming 1 02-16-2004 12:10 PM
how to use fork and semaphore in C/C++ in Linux? cs87668 Programming 1 06-20-2003 10:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration