locking mutexes, threads & semahores


 
Thread Tools Search this Thread
Top Forums Programming locking mutexes, threads & semahores
# 1  
Old 12-20-2008
locking mutexes, threads & semahores

Quote:

pthread_mutex_init
pthread_mutex_lock, pthread_mutex_unlock
pthread_cond_init, pthread_cond_signal, pthread_cond_wait

mutex_lock, mutex_unlock, mutex_init

semget, sem_op, semctl
What is the difference between mutex_lock and pthread_mutex_lock ? Should I use both when using binary semaphores.

Also, what is the difference between using a binary semaphore and a counting semaphore where you wait on the condition variable ?


# 2  
Old 12-21-2008
1) mutex_lock works for solaris thread where as pthread_mutex_lock works between pthreads
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. HP-UX

Spawn more than 8 threads OpenMP & HPUX

Hi folks, I am trying to run more than 8 threads in OpenMP team on my HP-UX 11i v3 system (without root access), but NO success. Compiler: aCC A.06.26 I tried to setup: OMP_NUM_THREADS, omp_set_num_threads(), max_thread_proc=1000, nkthread=8416, set_dynamic=0 Machine has 2 processors... (1 Reply)
Discussion started by: ATveretinov
1 Replies

2. UNIX for Advanced & Expert Users

mandatory & record locking using client server architecture

Hi I want a program of employee database locking with mendatory & record locking using client server architecture .there are two type of clients one which has all permissions of read/write called supervisor & another can only read the file.employee data base should contain 1) name 2)ID 3)BU... (1 Reply)
Discussion started by: rluha
1 Replies

3. Shell Programming and Scripting

PHP read large string & split in multidimensional arrays & assign fieldnames & write into MYSQL

Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP. I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies

4. Shell Programming and Scripting

File locking (Unix/Linux) & sftp

Hi all, Can anyone help ...on how to ensure that a file is locked . thanks & regards, Soodoo ---------------------------------------- Problem description: - We usually use the mv command in scripts to make sure that a file is complete and not being written to by another process. ... (1 Reply)
Discussion started by: soodoo
1 Replies

5. UNIX for Advanced & Expert Users

Native & Green Threads

Hi, While compiling an application on Solaris 10, I observe the following printout. The same compilation passed some time ago(but perhaps the compilers were different then! We are maintaining this product and lost track of previous changes). ... (1 Reply)
Discussion started by: smanu
1 Replies

6. UNIX for Dummies Questions & Answers

pthread condition variables and mutexes?

I am trying to understand the exact difference between condition variables and mutexes in thread synchronization ?. I know mutex will control the thread access to shared data and condition variables will be useful for waiting for certain event or condition to occur . But I couldn't understand why... (2 Replies)
Discussion started by: siddaonline
2 Replies

7. UNIX for Advanced & Expert Users

Threads and Threads Count ?

Hi all, How can I get the list of all Threads and the Total count of threads under a particular process ? Do suggest !! Awaiting for the replies !! Thanks Varun:b: (2 Replies)
Discussion started by: varungupta
2 Replies

8. Programming

How to wait on multiple semaphores/mutexes

I thought one used the select function to wait on multiple semaphores but according to http://opengroup.org/onlinepubs/007908799/xsh/select.html, the select function is only good for I/O features (like pipes and fifos). How can I block for multiple semaphores? What if I have a mixture of things... (1 Reply)
Discussion started by: siegfried
1 Replies

9. Programming

C++ variable scope and mutexes

I've been wondering if I can make mutexes much easier to use in C++ with creative use of a locking class and variable scope, but I'm not sure if things happen in the order I want. Here's pseudocode for something that could use the class: int someclass::getvalue() { int retval; ... (0 Replies)
Discussion started by: Corona688
0 Replies
Login or Register to Ask a Question