Home > Back-end >  A question about thread design and the object
A question about thread design and the object

Time:10-03

I am novice, is using the Delphi XE6 iOS application, had been using cb, start to do the iOS found when cb or ugly stepchild, encapsulation obj - a lot of inconvenient, while c then turned to Delphi development


The first thread problem is, I hope the program start when you start a thread, a thread within encapsulates the NSURLConnection asynchronous operations, then the entire life cycle in a program to insert tasks within the thread, the thread inside access a common object can be used in a critical section operation, but I don't know if security access task within the process of the object list. Or in other ways?


Is the second question triggered the first question, I good NSURLConnection class USES the asynchronous operation. Xe6 with ARC mechanism, if the reference count to zero cannot be destroyed.

In the call of this class, because it is asynchronous operations, I can't in the right time will count clear zero, leading to the object cannot be released. I try to put the object pointer to an object instance, at the right time to explicitly call freeandnil, can realize the asynchronous operation completed instance automatically destroyed. But in the xcode memory detection tools found leakage. Finally within Destoy method using the iOS API to destroy object obj - c, memory leak no longer, but freeandnil when abnormal, can't realize self destruction. So just think of the thread to manage a never release, specify the number of instances NSURLConnection request pool. Do you have any other ideas can let the object automatically destroyed?
  • Related