Re: threads without threads
From: Thomas Matthews (Thomas_MatthewsSpitsOnSpamBots_at_sbcglobal.net)
Date: 08/27/04
- Next message: pete: "Re: another stupid c bug. (endless for loop)"
- Previous message: its me: "Re: another stupid c bug. (endless for loop)"
- In reply to: sindica_at_gmail.com: "threads without threads"
- Next in thread: Malcolm: "Re: threads without threads"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 27 Aug 2004 20:47:51 GMT
sindica@gmail.com wrote:
> Hello,
>
> I have a counter loop which actually executes in a different thread.
> The thread is there to check for a connection time out. However due to
> some limitations, I cannot use pthreads or any OS dependant components
> (my code should run on both windows and linux). I have to relegiously
> stick on to ANSIC standard. Does ANSI C provide any inherent function
> which could accomplish what I intend to do. Or putting it otherway,
> how can I just deviate from my direct execution path and just return
> to it after a stipulated time has elapsed.
>
> ~saraca
As far as sleeping goes, there is no support for task suspension
in the ANSI C language.
However, you _could_ write a wrapper function for your platform
specific code. Just supply different implementations based upon
the platform. This is what many cross platform project do.
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
- Next message: pete: "Re: another stupid c bug. (endless for loop)"
- Previous message: its me: "Re: another stupid c bug. (endless for loop)"
- In reply to: sindica_at_gmail.com: "threads without threads"
- Next in thread: Malcolm: "Re: threads without threads"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|