mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
Bugfix in test program!
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4590 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4970d3c023
commit
9cdbb8e20e
2 changed files with 8 additions and 5 deletions
|
@ -32,6 +32,7 @@
|
|||
#include <Foundation/NSLock.h>
|
||||
#include <Foundation/NSThread.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
|
||||
// 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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue