Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
NSThreading
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Andor Kocsis  
View profile  
 More options Nov 13 2012, 4:46 pm
Newsgroups: gnu.gnustep.discuss
From: Andor Kocsis <andor_koc...@yahoo.com>
Date: Tue, 13 Nov 2012 13:46:44 -0800 (PST)
Local: Tues, Nov 13 2012 4:46 pm
Subject: NSThreading

Could someone help me plz with this simple program?

--------------------------------------------------------------
#import <Foundation/Foundation.h>

@interface obj1: NSObject { }
-(void) do_it:(id)p1;
@end

@implementation obj1
-(void) do_it:(id)p1 {
  NSAutoreleasePool* pool= [[NSAutoreleasePool alloc] init];
  NSLog(@"obj1#tick");
  [pool drain];}
@end

int main (int argc, const char * argv[]) {
  NSAutoreleasePool* pool= [[NSAutoreleasePool alloc] init];
  obj1* obj= [[obj1 alloc] init];
  [NSThread detachNewThreadSelector:
      NSSelectorFromString(@"do_it")
      toTarget:obj withObject:obj];
  NSLog(@"main#tick");
  [NSThread sleepForTimeInterval:0.5];
  [pool drain];
  return 0;}

-------------------------------------------------------------------------

Program's output:
-------------------------------------------------------------------------
2012-11-13 22:39:20.820 helloworld[2900] autorelease called without pool for obj
ect (0x749c58) of class GSCInlineString in thread <NSThread: 0x749b68>
2012-11-13 22:39:20.789 helloworld[2900] WARNING - unable to create shared user
defaults!
2012-11-13 22:39:20.836 helloworld[2900] main#tick
2012-11-13 22:39:20.836 helloworld[2900] autorelease called without pool for obj
ect (0x749400) of class NSException in thread <NSThread: 0x749b68>
2012-11-13 22:39:20.851 helloworld[2900] autorelease called without pool for obj
ect (0x36bc358) of class GSMutableArray in thread <NSThread: 0x749b68>
helloworld.exe: Uncaught exception NSInvalidArgumentException, reason: -[obj1 do
_it]: unrecognized selector sent to instance 0x748690

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

-------------------------------------------------------------------------

Using latest SDK on Windows. There isn't any compile time error or warning. How to fix this simple NSThread example to run properly?

Thx,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jamison Hope  
View profile  
 More options Nov 13 2012, 5:08 pm
Newsgroups: gnu.gnustep.discuss
From: Jamison Hope <j...@theptrgroup.com>
Date: Tue, 13 Nov 2012 17:08:05 -0500
Local: Tues, Nov 13 2012 5:08 pm
Subject: Re: NSThreading
That should be 'NSSelectorFromString(@"do_it:")' with the colon at the end.
At least, that fixes it compiling/running on Cocoa, so I assume it's the
same issue for GNUstep.. and it is, look at your error message:

> reason: -[obj1 do_it]: unrecognized selector

Jamie

On Nov 13, 2012, at 4:46 PM, Andor Kocsis <andor_koc...@yahoo.com> wrote:

--
Jamison Hope
The PTR Group
www.theptrgroup.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Davie  
View profile  
 More options Nov 13 2012, 5:25 pm
Newsgroups: gnu.gnustep.discuss
From: Tom Davie <tom.da...@gmail.com>
Date: Tue, 13 Nov 2012 22:24:57 +0000
Local: Tues, Nov 13 2012 5:24 pm
Subject: Re: NSThreading

On 13 Nov 2012, at 22:08, Jamison Hope <j...@theptrgroup.com> wrote:

> That should be 'NSSelectorFromString(@"do_it:")' with the colon at the end.
> At least, that fixes it compiling/running on Cocoa, so I assume it's the
> same issue for GNUstep.. and it is, look at your error message:

Or, alternatively, @selector(do_it:), which will allow the compiler to verify that the selector actually exists somewhere.

Bob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andor Kocsis  
View profile  
 More options Nov 14 2012, 4:11 am
Newsgroups: gnu.gnustep.discuss
From: Andor Kocsis <andor_koc...@yahoo.com>
Date: Wed, 14 Nov 2012 01:11:43 -0800 (PST)
Local: Wed, Nov 14 2012 4:11 am
Subject: Re: NSThreading

Thanks to everyone for fast and accurate help. Selector fixed to "do_it:", and it works now. However still have a warning, and have no idea, how to avoid it. Programs output now:

------------------------------------------------
2012-11-14 09:13:32.020 helloworld[3096] obj1#tick
2012-11-14 09:13:31.980 helloworld[3096] WARNING - unable to create shared user
defaults!
2012-11-14 09:13:32.030 helloworld[3096] main#tick
------------------------------------------------

It complains only when NSThread starts - no warning about user defaults without NSThread. I am with admin rights on my Windows 7 system, and should not be a problem to create a file, if something library function really want to do that in depths. Also searched for a user defaults file, what it should to be on Windows system, thought no problem with creation, if system already have it. Not so much found.

Can i download one somewhere? Or any other way to fix it?

________________________________
 From: Tom Davie <tom.da...@gmail.com>
To: Jamison Hope <j...@theptrgroup.com>
Cc: Andor Kocsis <andor_koc...@yahoo.com>; discuss-gnus...@gnu.org
Sent: Tuesday, November 13, 2012 11:24 PM
Subject: Re: NSThreading

On 13 Nov 2012, at 22:08, Jamison Hope <j...@theptrgroup.com> wrote:

> That should be 'NSSelectorFromString(@"do_it:")' with the colon at the end.
> At least, that fixes it compiling/running on Cocoa, so I assume it's the
> same issue for GNUstep.. and it is, look at your error message:

Or, alternatively, @selector(do_it:), which will allow the compiler to verify that the selector actually exists somewhere.

Bob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luboš Doležel  
View profile  
 More options Nov 14 2012, 4:56 am
Newsgroups: gnu.gnustep.discuss
From: Luboš Doležel <lu...@dolezel.info>
Date: Wed, 14 Nov 2012 10:56:09 +0100
Local: Wed, Nov 14 2012 4:56 am
Subject: Re: NSThreading
On Windows 7, the application IMO needs to actually request admin
privileges in order to have them.

Try running the app under admin privileges (right click - Run as
administrator) and it should be OK.

Lubos

On 14.11.2012 10:11, Andor Kocsis wrote:

--
Luboš Doležel

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »