Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Oct 2002 09:22:21 -0800
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        David O'Brien <obrien@FreeBSD.ORG>
Cc:        Chad David <davidc@issci.ca>, freebsd-current@FreeBSD.ORG
Subject:   Re: Objective-C threads
Message-ID:  <20021030092220.A18067@FreeBSD.org>
In-Reply-To: <20021030170916.GA13375@dragon.nuxi.com>; from obrien@FreeBSD.ORG on Wed, Oct 30, 2002 at 09:09:16AM -0800
References:  <20021029190941.A43525@newton.issci.ca> <3DBF4C35.B554A7C1@mindspring.com> <20021029211322.B45337@newton.issci.ca> <3DBF8FD8.A68747D8@mindspring.com> <20021030101943.GB80447@dragon.nuxi.com> <20021030092353.D58476@newton.issci.ca> <20021030170916.GA13375@dragon.nuxi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
* De: David O'Brien <obrien@FreeBSD.ORG> [ Data: 2002-10-30 ]
	[ Subjecte: Re: Objective-C threads ]
> On Wed, Oct 30, 2002 at 09:23:53AM -0700, Chad David wrote:
> > 
> > Which brings us back to my original question... why are ObjC threads
> > disabled?  I don't much care about my other patches, I just want
> > to know who the 10 others are who will break if we enable threads,
> > and how to fix that breakage.  My minor patches were only posted because
> > you asked :).
> 
> I am not sure.  But for some reason you didn't provide a patch that would
> turn them on.  All you provided was a minor patches that really should go
> thru the offical FSF GCC repo in-route to FreeBSD.  So back to my
> original request.  Do you have a patch for changing this part of the way
> we configure and build ObjC that you feel might be wrong?

With a simple test program,

%%%

#include <objc/Object.h>
#include <pthread.h>
#include <stdio.h>

@interface Test : Object {
    const char *string;
}
-(void) set:(const char *)str;
-(void) print;
@end

@implementation Test
-(void) set:(const char *)str {
    string = str;
}
-(void) print {
    printf("Test: %s\n", string);
}
@end

id obj;

static void *thr(void *ctxt __unused)
{
	[obj print];
	[obj set:"Inside"];
	[obj print];
}

void main(void)
{
	pthread_t td;

	obj = [Test alloc];
	[obj set:"Threads"];
	pthread_create(&td, NULL, thr, NULL);
	pthread_yield();
	exit(0);
}
%%%

It seems a simple case doesn't break:

(jmallett@luna:~)121% cc test.m -lobjc -pthread
test.m: In function `main':
test.m:31: warning: return type of `main' is not `int'
(jmallett@luna:~)122% ./a.out
Test: Threads
Test: Inside

Simply with using thr-posix.c.

%%%
(jmallett@luna:~/gnu/lib/libobjc)128% cvs diff
cvs server: Diffing .
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/gnu/lib/libobjc/Makefile,v
retrieving revision 1.14
diff -r1.14 Makefile
14c14
< 	thr.c thr-single.c \
---
> 	thr.c thr-posix.c \
%%%

Thanks,
juli.
-- 
Juli Mallett <jmallett@FreeBSD.org>       | FreeBSD: The Power To Serve
Will break world for fulltime employment. | finger jmallett@FreeBSD.org
http://people.FreeBSD.org/~jmallett/      | Support my FreeBSD hacking!

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021030092220.A18067>