Subject: Re: CVS commit: pkgsrc/lang/libtcl-nothread
To: Jim Wise <jwise@draga.com>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-pkg
Date: 07/02/2004 12:22:27
This is a multipart MIME message.

--==_Exmh_4122762229250
Content-Type: text/plain; charset=us-ascii


jwise@draga.com said:
>  there do seem to be performance gains to using the libtcl-nothread in
> cases where the linked app does not need thread safety

Yep, I guess that GNU pth is significantly worse in this respect.
But, as said, it is not just the performance. I'll append a small
program which shows that it is not a good idea to dynamically
load libpthread into a program which was not built with -lpthread
from the beginning. Hope this helps to convince you...

best regards
Matthias



--==_Exmh_4122762229250
Content-Type: text/plain ; name="ldpth.c"; charset=us-ascii
Content-Description: ldpth.c
Content-Disposition: attachment; filename="ldpth.c"

#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <dlfcn.h>
#include <err.h>

int flag;

void
hdl(int sig)
{
	flag = 1;
}

int
main()
{
	void *dlhdl;

	signal(SIGUSR1, hdl);
#if 1
	dlhdl = dlopen("/usr/lib/libpthread.so", RTLD_NOW);
	if (!dlhdl)
		errx(1, "%s", dlerror());
#endif

	kill(getpid(), SIGUSR1);
	sleep(1);
	printf("flag=%d\n", flag);
	return (0);
}

--==_Exmh_4122762229250--