Hi Ken,

Sorry for opening up old thread. I noticed that the code I shared earlier
has stopped working in my app.

 QCCAESPadCryptor *  op;
    NSString *licenseKey = nil;
    NSOperationQueue *queue;
    op = [[QCCAESPadCryptor alloc] initToDecryptInputData:[NSData
dataWithBytes:cyphertext_dat length:sizeof(cyphertext_dat)]
                                                  keyData:[NSData
dataWithBytes:key_dat length:sizeof(key_dat)]
          ];
    op.ivData = [NSData dataWithBytes:iv_dat length:sizeof(iv_dat)];
    queue = [[NSOperationQueue alloc] init];
    [queue addOperation:op];
    [queue waitUntilAllOperationsAreFinished];


The thread was created to ask about this behaviour in daemon. However this
was working fine on my app for a while and now stopped working. I am not
even sure why its not working.
After [queue waitUntilAllOperationsAreFinished];
    
if (op.outputData != nil) {
        authString = [[[NSString alloc] initWithData:op.outputData
encoding:NSUTF8StringEncoding] autorelease];
    }

op.outputData is nil. This was not the case before. I don’t know how to
debug this. During the last discussion there was discussion about
mainThread. So I even tried a little experiment



- (void) runOp:(id) obj
{
    QCCAESPadCryptor *  op = obj;
    [queue addOperation:op];
    [queue waitUntilAllOperationsAreFinished];
}



[self performSelectorOnMainThread:@selector(runOp:) withObject:op
waitUntilDone:YES];


Neither did this work. Any suggestions?

Regards,
Varun

On 4/04/2014 11:16 am, "Ken Thomases" <k...@codeweavers.com> wrote:

>On Apr 3, 2014, at 7:02 PM, Varun Chandramohan wrote:
>
>> On 4/04/2014 10:47 am, "Jerry Krinock" <je...@ieee.org> wrote:
>> 
>>> On 2014 Apr 03, at 16:11, Varun Chandramohan
>>> <varun.chandramo...@wontok.com> wrote:
>>> 
>>>> when I port the same code to be used as a user daemon, I noticed that
>>>> NSOperationQueue fails.
>>> 
>>> I¹d suspect a run loop issue.  For example, maybe your daemon is
>>>exitting
>>> before the operation begins.
>> 
>> Oh you mean, the runloop has not been initialised and the daemon is
>> exiting before that?
>> That could be the cause. Thanks I will investigate.
>
>If the code that was shown was running on the main thread, then the
>process should not have exited.  The code called [queue
>waitUntilAllOperationsAreFinished].
>
>In general, operation queues don't rely on the run loop.
>
>It is correct that if the code shown was in a background thread and
>nothing was keeping the main thread from exiting, then the process will
>be terminated, likely before the operation finished (or maybe even
>started) executing.  Parking the main thread in a loop running its run
>loop, assuming the run loop has at least one input source, is one way of
>preventing the main thread from exiting.  But that's the only tenuous
>relationship between run loops and operation queues.
>
>Regards,
>Ken
>


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to