Re: mono
Hi,
On Sat, Nov 25, 2006 at 12:06:30AM -0500, Barry deFreese wrote:
> Now that we have graphviz,
Well, graphviz is only needed to make nice graphs for documentation, so
not having it shouldn't stop any code porting efforts.
> I decided to try to build mono. Aside from a PATH_MAX issue, it
> appears that we don't define: PTHREAD_STACK_MIN
>
> The following code seems to be the culprit: mono/io-layer/collection.c
>
> #ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
> #ifdef __FreeBSD__
> ret = pthread_attr_setstacksize (&attr, 65536);
> #else
> ret = pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
> #endif
> g_assert (ret == 0);
> #endif
We had the same issue with glib2.0 a while ago. Currently, glib2.0 has
the following code in gthread/gthread-posix.c, where stack_size can be
requested from the user, which makes it slightly more complicated:
#ifdef _SC_THREAD_STACK_MIN
g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), 0);
#endif /* _SC_THREAD_STACK_MIN */
[...]
#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
if (stack_size)
{
stack_size = MAX (g_thread_min_stack_size, stack_size);
/* No error check here, because some systems can't do it and
* we simply don't want threads to fail because of that. */
pthread_attr_setstacksize (&attr, stack_size);
}
#endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */
Note that contrary to the mono code above, the return value of
pthread_attr_setstacksize() isn't asserted. Neal and I requested that
change as our pthread_attr_setstacksize() only accepts a stack_size of
2MB and returns with invalid argument for all other values (so
pthread_attr_setstacksize (&attr, 65536) would just error out as well).
As setting the stack size is optional (it is only done if
pthread_attr_setstacksize() is available in the first place), mono
shouldn't abort if it fails, either.
For more discussion see http://bugzilla.gnome.org/show_bug.cgi?id=304790
and the therein quoted mail from this list:
http://lists.debian.org/debian-hurd/2005/05/msg00117.html
Arguably, we maybe should #define PTHREAD_STACK_MIN to 2MB.
Michael
Reply to:
- Follow-Ups:
- Re: mono
- From: "Neal H. Walfield" <neal@walfield.org>
- References:
- mono
- From: Barry deFreese <bddebian@comcast.net>