views:

88

answers:

0

Hi, I had the following situtation, I'm reading and parsing some packets from the network within a separated thread (not the main thread).

After this, I'm trying to put them into a CFWriteStreamRef (created using CFStreamCreateBoundPair, in order to get a CFReadStreamRef that could be able to read the bytes from the writer stream) in a separate class.

But once I set CFReadStreamScheduleWithRunLoop to a different thread the headaches appears; if I create the writer/reader class inside the reader/parser thread (not the main), everything works fine except the CFReadStream callbacks, the CFReadStreamRef, never gets the new bytes notification, in the other hand, if I create the writer/reader class in the mainthread, the notifications goes OK, but I got "Program received signal: “EXC_BAD_ACCESS”" error, I already tried to fake the notification in the first case, but it seems to be a multithreading/concurrence problem, somebody has experienced the same, or they're any other method to do what I'm trying to do ?

Thanks in advance.