linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Raghuveer <rvk@gsecone.com>
To: Jason Cooper <jcooper@nevernight.net>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: good pthreads example?
Date: Mon, 22 Sep 2003 18:22:32 +0530	[thread overview]
Message-ID: <3F6EF090.3060208@gsecone.com> (raw)
In-Reply-To: <20030921153731.GB4142@nevernight.net>

Hi Cooper,

I donno whether this basic example will be enough for ur requirement, 
anyway here it is,
You can try creating the thread like...
void func(void);
main()
{
    pthread_t tid;
    retVal = pthread_create(&tid, NULL, (void *)func, (void *) NULL);
    /* validate here with retVal */
}

void
func(void)
{
    pthread_detach(pthread_self()); /* if detached thread */
    /* some printf */
}

Pls ignore if this is very basic.

Regards
-Raghu


Jason Cooper wrote:

>Hey all,
>
>I've been learning pthreads for the past week or so.  So far, I've read
>through the man pages, "Pthreads Programming" from O'Reilly, an old
>copy of POSIX 4, and other various google searches.
>
>What I'm looking for is a good example (open source, of course) of 
>pthreads in practice.  It doesn't matter whether it's boss/worker,
>peer/peer, or assembly line.  I'm looking for practical examples to
>learn from.  
>
>The O'Reilly book has a good ATM (cash machine, client/server) example,
>but it isn't implemented in the real world...
>
>TIA,
>
>Cooper.
>
>PS - I know grepping through source will provide plenty of examples of
>pthreads in action, but I wouldn't know if they are sound
>implementations or not.
>-
>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
>
>  
>



  reply	other threads:[~2003-09-22 12:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-21 15:37 good pthreads example? Jason Cooper
2003-09-22 12:52 ` Raghuveer [this message]
2003-09-22 13:14   ` Jason Cooper
     [not found] <8EA11405E59BD611BA7100104B93C26002254BE0@exdel01.del.mgsl.com>
2003-09-24 14:20 ` Jason Cooper
2003-09-24 14:58   ` Mariano Moreyra
2003-09-24 16:42   ` Helmut Djurkin

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=3F6EF090.3060208@gsecone.com \
    --to=rvk@gsecone.com \
    --cc=jcooper@nevernight.net \
    --cc=linux-c-programming@vger.kernel.org \
    /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).