11 Discussion / Question Topics

Remove Filter
Member Avatar for
Member Avatar for Darth Vader

Hello, I wonder how we can use lock objects between 2 different applications. In the example below we can use lock objects to let only one thread to execute the code inside the lock object at a time. This works fine within one application. Now I wonder how we can …

Member Avatar for JamesCherrill
0
306
Member Avatar for rudasi

I have 2 processes (producer and consumer) sharing an int deque in shared memory, I have the producer process put 2 numbers in the deque and then it gets in a wait state losing its mutex lock. I then have the consumer process removing the numbers and printing them. It …

Member Avatar for rudasi
0
515
Member Avatar for srivardhanms

Hi, I have two threads A and B. Thread A prints only odd numbers. Thread B prints only even number. I want to synchronize it in such a way that on the screen I get continues numbers. How can I do that? I was thinking of using sockets. Thread A …

Member Avatar for Yerbantherack
0
255
Member Avatar for nerdygirl118

The assignment is to implement the Banker's Algorithm using pthreads and mutex locks. We implemented the Banker's Algorithm and it works fine. When we began implementing the pthreads and mutex locks we ran into problems. We know that each process is a thread, and that the mutex lock is acquired …

Member Avatar for deceptikon
0
153
Member Avatar for kesuke

Can I use semaphore or mutex on MikroC? If you know , please tell me the function name or exsample code.

Member Avatar for I_m_rude
0
102
Member Avatar for ahp@aol.in

Hi folks, I need a solution for following scenario. 1. Suppose two processes running simulteneously. 2. Process (P1) has already locked a mutex (M1). 3. Process (P2) is trying to lock same mutex (M1) but as it is already locked by (P1), P2 is waiting for unlocking (M1). 4. Now …

Member Avatar for ahp@aol.in
0
182
Member Avatar for smith32

[CODE] sem_t w,r,s1,s2,s3; pthread_mutex_t m; int main(int argc, char* argv[]) { mutex and semaphores initialization ..... call threads.... wait until finish and cancel threads... clean threads and semaphores [I]exit;[/I] } void *reader(void *argv) { while(TRUE) { sem_wait(&r); sem_wait(&s1); pthread_mutex_lock(&m); ... read data..... pthread_mutex_unlock(&m); sem_post(&s1); sem_post(&w); } printf("Done read\n"); sem_post(&extra2); pthread_exit(NULL); …

Member Avatar for Abhineet.Ayan
0
172
Member Avatar for CJdamaster

Hi there, I'm working on a project which incorporates the following: [LIST] [*]Reading data from XML [*]Writing data to XML [*]Interpreting XML and passing the information to various places [/LIST] These are on different threads, and I've used a Mutex to make sure they don't try opening the main XML …

Member Avatar for CJdamaster
0
163
Member Avatar for yuri1969

Hi, I would like to make an threaded app which would use pthreads. I made a linked list and I put references to running threads here. I know that operations of adding a new thread reference to the list and removing a thread reference from the list after the thread …

Member Avatar for yuri1969
0
171
Member Avatar for nitin2010

I have a static function that write to a log file . In my project I am already using multithreading , hense I m getting exception that 'process can't access file because it is being used by another process ' I want to mutex that code so that if one …

Member Avatar for powerbox
0
139
Member Avatar for dshiells

Basically I am trying to learn multithreading in C++. Platform: Windows XP. So far so good but I want to make sure I'm using mutex correctly. It compiles and runs as expected, but just wanted to make sure I use the CreateMutex() function in the correct place. Thanks! Here's my …

Member Avatar for thelamb
0
1K

The End.