Thread synchronisation


 
Thread Tools Search this Thread
Top Forums Programming Thread synchronisation
# 1  
Old 06-06-2012
Thread synchronisation

hi,

i have to do a program with following condition. please help me to write the program.
conditions-i have to create a thread with handle called first and it should call the member function(may do anything lik print anything) of a class called thread1 and for example let take that this first thread executes in 5 minutes and this thread with handle called first must create another thread with handle called second which executes a member function in another class called thread 2.let take this thread takes 10 minutes to complete.lets take the main function will get over in 2 minutes.i should synchronise the main function and the two threads without using any predefined function like pjoin etc..


i have to synchronise the main function and two thread without using predefined functions like pjoinetc.this is my problem in simple terms.. could anyone help please..
# 2  
Old 06-06-2012
Why can you not use pthread_join(), etc. You have to use a thread library to create threads. This sounds a little like homework.
# 3  
Old 06-07-2012
RE:Thread synchronisation

@jim mcnamara

hi, ya it looks like home work only but i want to implement this without using pjoin function.i can create thread using a function in thread library but should not use pjoin to wait for that thread to complement..i should implement this by wrriting my own code.. how can i do this.please help me...
# 4  
Old 06-07-2012
Again, why? What requirements does the pre-existing function not fulfill? Without knowing that we're likely to duplicate the same problem other ways...
# 5  
Old 06-07-2012
RE:Thread synchronisation

my tutor asked me to do without using pjoin so that i can understand lot about thread how it works, how can we use it,how synchorisation works like that..
# 6  
Old 06-07-2012
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Synchronisation of 2 arrays

If the element found in array2 doesn't exist in array1 i want i to be deleted. This code doesn't work correctly. What's wrong? Is there a simpler solution? for (( i=0; i<=${#array2}; i++ )) do for (( v=0; v<=${#array1}; v++ )) do if }" = "{$array1}" ] then count=1 break... (3 Replies)
Discussion started by: iums1
3 Replies

2. Shell Programming and Scripting

rsync script for synchronisation and backup

hello, i need to modified my synch/back scripts.... i want that this script only syncro folders in destinationfolder. f.e. when in destination are two folders 1) admin 2) users but in SOURCE are three: 1) admin 2) users 3) antivirus the script should only increnmential sync the... (0 Replies)
Discussion started by: onkeldave
0 Replies

3. UNIX for Dummies Questions & Answers

Need help on file synchronisation in unix

i want to do file synchronisation...its a client-server model..have to do system call 'ls -l' in both client and server ..the server has to keeep track of client files and have to keep a back up of client files..and tracking must be done based on time stamp.. suppose if client contains a file... (2 Replies)
Discussion started by: shilpam,edappal
2 Replies

4. UNIX for Advanced & Expert Users

Thread synchronisation problem...

Hello, hope my english will be sufficient to be clear enough... I'm in progress on some script that should copy one big source file (200GB average) on one sata drive, to multiple (30+) sata drives. Hardware is not the problem but copy performance is... If i launch all copy process at the same... (4 Replies)
Discussion started by: Gnaag
4 Replies

5. Shell Programming and Scripting

sh : URGENT synchronisation insmod in script

Hello, By now in linux 2.4, I have a sh script wich start 2 modules as follow : /sbin/insmod module1.o /sbin/insmod module2.o I added an application in user space named "user_app" which communicate with module1 with a /proc. I now tape the commands myself during code execution on a... (1 Reply)
Discussion started by: crip01
1 Replies

6. UNIX for Advanced & Expert Users

shared memory synchronisation

hello everybody i want to do synchronisation to access a shared memory bu i don't know too much how well i know that i should use semaphore have you any example of synchronisation of a shared memory by use of semaphore because i haven't find any thanks (0 Replies)
Discussion started by: student00
0 Replies
Login or Register to Ask a Question