__spin_lock while writing the bytes in NSOutputStream

Posted by Mohammed Sadiq on Stack Overflow See other posts from Stack Overflow or by Mohammed Sadiq
Published on 2010-03-12T07:12:17Z Indexed on 2010/03/12 7:17 UTC
Read the original article Hit count: 438

Filed under:

HI all,

I have a issue that when I try to write some bytes in the outputstream, I am getting the 

bad access. The code is as follows :

int writtenBytes = [_os write:[packetInBytes bytes] maxLength:lengthOfPacket];

where the "packetInBytes" points to NSData and "lengthOfPacket" corresponds to the data length, and _os represents the NSOutputStream.

The call stack from the debugger is as follows :

0 0xffff0269 in __spin_lock

1 0x302a6098 in CFSocketDisableCallBacks

2 0x003b46d0 in SocketStream::write

3 0x302402c3 in CFWriteStreamWrite

4 0x0001b423 in -[Writer write:] at Writer.m:96

5 0x0001b5ef in -[Writer run] at Writer.m:111

6 0x3050a79d in -[NSThread main]

7 0x3050a338 in NSThread__main

8 0x91a27fe1 in _pthread_start

9 0x91a27e66 in thread_start**

I am not getting this issue always. I get this issue execute my code for some 5 or more times ... I have checked all the params that i pass to the write function have its values and not nil.

Any help would be greatly appreciated

Best Regards, MOhammed Sadiq.

© Stack Overflow or respective owner

Related posts about iphone