diff --git a/ChangeLog b/ChangeLog index 24d6b7f68..783051771 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,9 @@ -Wed Jul 14 17:36:00 1999 Richard Frith-Macdonald +Wed Jul 14 20:19:00 1999 Richard Frith-Macdonald * Source/NSThread.m: Make sure that a thread retains the target object and argument of the method with which it is detached. + * Testing/diningPhilosophers.m: Fixed bug - was passing non NSObject + argument. Wed Jul 14 16:58:00 1999 Richard Frith-Macdonald diff --git a/Testing/diningPhilosophers.m b/Testing/diningPhilosophers.m index b9ccac472..e2704fbdb 100644 --- a/Testing/diningPhilosophers.m +++ b/Testing/diningPhilosophers.m @@ -32,6 +32,7 @@ #include #include #include +#include // Conditions #define NO_FOOD 1 @@ -50,7 +51,7 @@ id forks[5]; } // Instance methods -- (void)sitAtChair:(int)position; +- (void)sitAtChair:(NSNumber*)position; - (int)chair; @end @@ -58,12 +59,12 @@ id forks[5]; @implementation Philosopher // Instance methods -- (void)sitAtChair:(int)position +- (void)sitAtChair:(NSNumber*)position { int i; // Sit down - chair = position; + chair = [position intValue]; // Its a constant battle to feed yourself while (1) @@ -131,7 +132,7 @@ int main() // Have them sit at the table for (i = 0;i < 5; ++i) [NSThread detachNewThreadSelector:@selector(sitAtChair:) - toTarget:p[i] withObject: (id)i]; + toTarget:p[i] withObject: [NSNumber numberWithInt: i]]; // Now let them all eat for (i = 0;i < 5; ++i)