From: Ron Michael Khu <ronkhu@ntsp.nec.co.jp>
To: SVisor <svisor@lycos.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: How to suspend a thread (without pthread)
Date: Wed, 25 May 2005 14:23:56 +0800 [thread overview]
Message-ID: <429419FC.2090102@hq.ntsp.nec.co.jp> (raw)
In-Reply-To: <d714qk$8iu$1@sea.gmane.org>
what do u mean by suspend?
sleep/block? if ur looking for a time-based threadsleep
maybe u can make use(improvise) with the select() function.
for example:
void threadSleep( int sec )
{
struct timeval stTimeOut;
int nSel;
stTimeOut.tv_sec = sec; /* Set the number of seconds */
stTimeOut.tv_usec = 0; /* Set the number of micro seconds */
nSel = select( 0, NULL, NULL, NULL, &stTimeOut);
}
what's wrong with using the pthread library? (ex: pthread_mutex_lock,
pthread_mutex_unlock)
license issues? client-preference issues? library-comptability?
SVisor wrote:
> As subject says,
>
> I need to suspend threads (for locking purpose) but I do not want to
> use Posix threads library (pthread). Neither do I want to access
> __KERNEL__ protected parts of the kernel API.
>
> There must be a user accesible API for this. The nearest Ive found is
> sched_yield( ), but it just moves a thread (process) to the end of
> run-queue.
>
> // Jarmo
>
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
next prev parent reply other threads:[~2005-05-25 6:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-25 6:11 How to suspend a thread (without pthread) SVisor
2005-05-25 6:23 ` Ron Michael Khu [this message]
2005-05-25 6:47 ` SVisor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=429419FC.2090102@hq.ntsp.nec.co.jp \
--to=ronkhu@ntsp.nec.co.jp \
--cc=linux-c-programming@vger.kernel.org \
--cc=svisor@lycos.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).