* good pthreads example?
@ 2003-09-21 15:37 Jason Cooper
2003-09-22 12:52 ` Raghuveer
0 siblings, 1 reply; 6+ messages in thread
From: Jason Cooper @ 2003-09-21 15:37 UTC (permalink / raw)
To: linux-c-programming
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: good pthreads example?
2003-09-21 15:37 good pthreads example? Jason Cooper
@ 2003-09-22 12:52 ` Raghuveer
2003-09-22 13:14 ` Jason Cooper
0 siblings, 1 reply; 6+ messages in thread
From: Raghuveer @ 2003-09-22 12:52 UTC (permalink / raw)
To: Jason Cooper; +Cc: linux-c-programming
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
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: good pthreads example?
2003-09-22 12:52 ` Raghuveer
@ 2003-09-22 13:14 ` Jason Cooper
0 siblings, 0 replies; 6+ messages in thread
From: Jason Cooper @ 2003-09-22 13:14 UTC (permalink / raw)
To: linux-c-programming
Raghuveer (rvk@gsecone.com) scribbled:
> 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.
Thanks for the reply, unfortunately, what I'm looking for is a
recommendation of a good FS/OSS package to look at which implements
pthreads.
As usual, my long-windedness confused the issue :)
Cooper.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: good pthreads example?
[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
0 siblings, 2 replies; 6+ messages in thread
From: Jason Cooper @ 2003-09-24 14:20 UTC (permalink / raw)
To: linux-c-programming
Harmeet Uppal (Harmeet_Uppal@KeaneIndia.com) scribbled:
> Hi Jason,
>
> I would suggest you start with Thread Time a book from HP Press and do
> chapter to chapter coding. It would be a great help.
>
> -Harmeet
>
> -----Original Message-----
> From: Jason Cooper [mailto:jcooper@nevernight.net]
> Sent: Monday, September 22, 2003 6:44 PM
> To: linux-c-programming@vger.kernel.org
> Subject: Re: good pthreads example?
>
>
> Raghuveer (rvk@gsecone.com) scribbled:
[snip]
> > 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.
>
> Thanks for the reply, unfortunately, what I'm looking for is a
> recommendation of a good FS/OSS package to look at which implements
> pthreads.
>
> As usual, my long-windedness confused the issue :)
>
> Cooper.
Thanks, I'll take a look at it.
I had a chance to grep through /usr/bin for 'pthread', and found
that almost everything appears to implement pthreads. Unfortunately,
grepping through /usr/sbin revealed that sshd (nor ssh from previous
search) does not implement pthreads. I had hoped that a package like
OpenSSH, which has a solid reputation, would have been a good example.
Oh well, qmail doesn't appear to either... Back to the books. *8v)
Perhaps apache or postfix? I don't use either, so I'll have to d'l them
later...
Cooper.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: good pthreads example?
2003-09-24 14:20 ` Jason Cooper
@ 2003-09-24 14:58 ` Mariano Moreyra
2003-09-24 16:42 ` Helmut Djurkin
1 sibling, 0 replies; 6+ messages in thread
From: Mariano Moreyra @ 2003-09-24 14:58 UTC (permalink / raw)
To: 'Jason Cooper', linux-c-programming
Apache does implement pthread starting from version 2
-----Mensaje original-----
De: linux-c-programming-owner@vger.kernel.org
[mailto:linux-c-programming-owner@vger.kernel.org]En nombre de Jason
Cooper
Enviado el: Miércoles, 24 de Septiembre de 2003 11:21
Para: linux-c-programming@vger.kernel.org
Asunto: Re: good pthreads example?
Harmeet Uppal (Harmeet_Uppal@KeaneIndia.com) scribbled:
> Hi Jason,
>
> I would suggest you start with Thread Time a book from HP Press and do
> chapter to chapter coding. It would be a great help.
>
> -Harmeet
>
> -----Original Message-----
> From: Jason Cooper [mailto:jcooper@nevernight.net]
> Sent: Monday, September 22, 2003 6:44 PM
> To: linux-c-programming@vger.kernel.org
> Subject: Re: good pthreads example?
>
>
> Raghuveer (rvk@gsecone.com) scribbled:
[snip]
> > 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.
>
> Thanks for the reply, unfortunately, what I'm looking for is a
> recommendation of a good FS/OSS package to look at which implements
> pthreads.
>
> As usual, my long-windedness confused the issue :)
>
> Cooper.
Thanks, I'll take a look at it.
I had a chance to grep through /usr/bin for 'pthread', and found
that almost everything appears to implement pthreads. Unfortunately,
grepping through /usr/sbin revealed that sshd (nor ssh from previous
search) does not implement pthreads. I had hoped that a package like
OpenSSH, which has a solid reputation, would have been a good example.
Oh well, qmail doesn't appear to either... Back to the books. *8v)
Perhaps apache or postfix? I don't use either, so I'll have to d'l them
later...
Cooper.
-
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
-
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: good pthreads example?
2003-09-24 14:20 ` Jason Cooper
2003-09-24 14:58 ` Mariano Moreyra
@ 2003-09-24 16:42 ` Helmut Djurkin
1 sibling, 0 replies; 6+ messages in thread
From: Helmut Djurkin @ 2003-09-24 16:42 UTC (permalink / raw)
To: Jason Cooper; +Cc: linux-c-programming
Hi,
the following (ugly) script lists all files (from /usr/bin) with
libpthread usage.
result looks like:
./tail uses libpthread
./python2.2 uses libpthread
./python uses libpthread
./rpm2cpio uses libpthread
./dig uses libpthread
./host uses libpthread
./nslookup uses libpthread
./nsupdate uses libpthread
./diff uses libpthread
<big-snip>
# ---------------------------------------------------------------------
#!/bin/bash
CMD_FILE=/usr/bin/file
CMD_LDD=/usr/bin/ldd
CMD_GREP=/bin/grep
CMD_PATH_TO_SEARCH=/usr/bin
LIB_STRING=libpthread
FILES=`find $PATH_TO_SEARCH -type f`
for file in $FILES; do
$CMD_FILE $file | $CMD_GREP dynamic 1>&2>/dev/null
if [ $? -eq 0 ]; then
$CMD_LDD $file | $CMD_GREP $LIB_STRING 1>&2>/dev/null
if [ $? -eq 0 ]; then
printf "%-20s uses $LIB_STRING\n" $file
fi
fi
done
# ---------------------------------------------------------------------
hope this helps.
bye helmut
Jason Cooper wrote:
> Harmeet Uppal (Harmeet_Uppal@KeaneIndia.com) scribbled:
>
>>Hi Jason,
>>
>>I would suggest you start with Thread Time a book from HP Press and do
>>chapter to chapter coding. It would be a great help.
>>
>>-Harmeet
>>
>>-----Original Message-----
>>From: Jason Cooper [mailto:jcooper@nevernight.net]
>>Sent: Monday, September 22, 2003 6:44 PM
>>To: linux-c-programming@vger.kernel.org
>>Subject: Re: good pthreads example?
>>
>>
>>Raghuveer (rvk@gsecone.com) scribbled:
>
> [snip]
>
>>>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.
>>
>>Thanks for the reply, unfortunately, what I'm looking for is a
>>recommendation of a good FS/OSS package to look at which implements
>>pthreads.
>>
>>As usual, my long-windedness confused the issue :)
>>
>>Cooper.
>
>
> Thanks, I'll take a look at it.
>
> I had a chance to grep through /usr/bin for 'pthread', and found
> that almost everything appears to implement pthreads. Unfortunately,
> grepping through /usr/sbin revealed that sshd (nor ssh from previous
> search) does not implement pthreads. I had hoped that a package like
> OpenSSH, which has a solid reputation, would have been a good example.
> Oh well, qmail doesn't appear to either... Back to the books. *8v)
>
> Perhaps apache or postfix? I don't use either, so I'll have to d'l them
> later...
>
> Cooper.
> -
> 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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-09-24 16:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-21 15:37 good pthreads example? Jason Cooper
2003-09-22 12:52 ` Raghuveer
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
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).