LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-12-2005, 01:01 AM   #1
geethu
LQ Newbie
 
Registered: Jul 2005
Location: India
Posts: 10

Rep: Reputation: 0
Thread query?


Can anybody suggest a function which can suspend only a particular thread without affecting other threads and processes in multithreaded program?

I tried sleep and usleep functions which didnt yield the result i wanted...
 
Old 08-12-2005, 01:58 AM   #2
JanusPaul
Member
 
Registered: Nov 2004
Location: Houston, Texas
Distribution: Ubuntu, Debian, Solaris, Free BSD
Posts: 82

Rep: Reputation: 15
There is the possibility while your threads are most likely select() idling, they could be waiting for a single on a pipe. Such that you pipe a flag the thread to wait for an unlock flag.

If you're trying to prevent multiple threads from accessing a shared system of data in the RAM. I would suggest that you make but just 1 function to access the shared information, and either pthread_mutex_(lock/unlock) it, or pthread_rwlock_(rd/wr/un)lock. Such a thing will cause all the calling threads to queue under the system until the current locking call frees that space. -WARNING- If you use mutex, make sure you unlock the function before you return, or else you may 'deadlock' your threads.

http://www.mkssoftware.com/docs/man3...tex_lock.3.asp
 
  


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
Test thread (Ignore this thread) operatester General 2 07-07-2005 02:04 PM
[thread control suggestion] add a "solved" button that the thread starter can click atom LQ Suggestions & Feedback 3 03-24-2005 11:55 AM
Main thread sending notification to child thread rajesh_b Programming 1 09-22-2004 09:15 AM
configure qt thread issue (just compiled qt w/ -thread option) cleff Linux - Software 8 05-07-2004 11:11 PM
send parameter from thread to thread marek Programming 2 09-08-2003 05:33 AM

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

All times are GMT -5. The time now is 07:28 PM.

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