You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by David Herrero <da...@usuarios.retecal.es> on 2003/11/22 01:41:35 UTC
Threads in a module
Hello, i'm trying to do a module that creates a thread with
pthread_create(...), and this thread open a socket. Well, i compile all
the source of apache with my module, and when i try to open the
comunication with the socket there isn't conection. I try to do it in a
simple C programm and the source of the thread and the socket is well.
Perhaps, i must compile the apache source with -lpthread option, but i
don't know how do it.
Thanks
Re: Threads in a module
Posted by Sander Temme <sc...@covalent.net>.
> Sonry, i don't write in english very well, when you do a programm which
> uses threads you must compile with:
>
> gcc example1.c -o example.out -lpthread
>
> My question is when i compile the apache sources, with make, make all
> and make install, where i must indicate the option -lpthread.
> In the module i include <pthread.h>
As I said, if your server starts with your module enabled, pthread was
somehow linked in. Should you want to link it in explicitly, you could set
and export the variable LDFLAGS to '-lpthread' prior to running configure.
This applies to any version of Apache.
I really recommend that you take your questions to the apache-modules list.
S.
--
Covalent Technologies sctemme@covalent.net
Engineering group Voice: (415) 856 4214
303 Second Street #375 South Fax: (415) 856 4210
San Francisco CA 94107
PGP FP: 7A8D B189 E871 80CB 9521 9320 C11E 7B47 964F 31D9
=======================================================
This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and
destroy all copies of the original message
=======================================================
RE: Threads in a module
Posted by David Herrero <da...@usuarios.retecal.es>.
Sonry, i don't write in english very well, when you do a programm which
uses threads you must compile with:
gcc example1.c -o example.out -lpthread
My question is when i compile the apache sources, with make, make all
and make install, where i must indicate the option -lpthread.
In the module i include <pthread.h>
Thanks
-----Mensaje original-----
De: Sander Temme [mailto:sctemme@covalent.net]
Enviado el: sábado, 22 de noviembre de 2003 1:58
Para: dev@httpd.apache.org
Asunto: Re: Threads in a module
Hey David,
A question like yours is probably better asked on the apache-modules
list. You can get on that by sending an empty mail to
apache-modules-subscribe@covalent.net.
> Hello, i'm trying to do a module that creates a thread with
> pthread_create(...), and this thread open a socket. Well, i compile
> all the source of apache with my module, and when i try to open the
> comunication with the socket there isn't conection. I try to do it in
> a simple C programm and the source of the thread and the socket is
> well. Perhaps, i must compile the apache source with -lpthread option,
> but i don't know how do it.
If lpthread wasn't part of your link phase, you'd get issues with
unresolved symbols either at link time or at run time. You may want to
check if the code that creates the thread actually gets executed, or
doesn't get executed more than once.
S.
--
Covalent Technologies sctemme@covalent.net
Engineering group Voice: (415) 856 4214
303 Second Street #375 South Fax: (415) 856 4210
San Francisco CA 94107
PGP FP: 7A8D B189 E871 80CB 9521 9320 C11E 7B47 964F 31D9
=======================================================
This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message
=======================================================
Re: Threads in a module
Posted by Sander Temme <sc...@covalent.net>.
Hey David,
A question like yours is probably better asked on the apache-modules list.
You can get on that by sending an empty mail to
apache-modules-subscribe@covalent.net.
> Hello, i'm trying to do a module that creates a thread with
> pthread_create(...), and this thread open a socket. Well, i compile all
> the source of apache with my module, and when i try to open the
> comunication with the socket there isn't conection. I try to do it in a
> simple C programm and the source of the thread and the socket is well.
> Perhaps, i must compile the apache source with -lpthread option, but i
> don't know how do it.
If lpthread wasn't part of your link phase, you'd get issues with unresolved
symbols either at link time or at run time. You may want to check if the
code that creates the thread actually gets executed, or doesn't get executed
more than once.
S.
--
Covalent Technologies sctemme@covalent.net
Engineering group Voice: (415) 856 4214
303 Second Street #375 South Fax: (415) 856 4210
San Francisco CA 94107
PGP FP: 7A8D B189 E871 80CB 9521 9320 C11E 7B47 964F 31D9
=======================================================
This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and
destroy all copies of the original message
=======================================================