Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 03-18-2006, 11:46 AM   #1 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 678
DJMaze is on a distinguished road
POSIX can't suspend pthread?

Everywhere i look i can't find the default implementation of pthread_suspend in POSIX.
It seems many pthread.h implementations have pthread_suspend() but not the opengroup.org one (which is used by linux), so i'm holding back untill i get some confirmations.

I want to know since one of my Win32 API functions runs a thread that recursively reads files from the harddisk. A dialog has 2 buttons: Cancel and Pause.
By clicking [Pause] it suspends the thread and waits till the user wants to continue or cancels.

Win32 has functions for this but i can't find it in pthread.
Someone has a clue or should i wrap around my own variable like
PHP Code:
while (!suspended) {

or a mutex
PHP Code:
pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *); 
DJMaze is offline   Reply With Quote
Old 04-18-2006, 10:30 PM   #2 (permalink)
AssKoala
Anti-Zealot
 
AssKoala's Avatar
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 72
AssKoala is on a distinguished road
Send a message via AIM to AssKoala Send a message via MSN to AssKoala Send a message via Yahoo to AssKoala
Wait on a condition variable.

pthread_suspend is not portable (and probably isn't POSIX). pthread_suspend probably wraps a call to pthread_cond_wait to a single function.

You can always write your own pthread_suspend and use that to make things more modular.

I realize this is a fairly old topic, but noone seems to have touched it.
__________________
If you always think like an expert, you'll always be a beginner. | "A handful of knowledgeable people is more effective than an army of fools" -Writing Secure Code, 2nd Ed.
AssKoala is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 11:06 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting