Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 02-25-2003, 11:20 PM   #1
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
__status 0
__spinlock 0
__sem_value 1
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
__status 3
__spinlock 0
__sem_value 0

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,


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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, ->, 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 > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:22 PM.

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