Problem using threads

Problem using threads
0.0 0


I’m using pthread to thread off a function that downloads a file using libcurl, which works fine. However, in that threaded function I’m trying to update the text on a CCLabelTTF. It seems to be updating however instead of showing the new text it becomes a white box with no text. The length changes though. Since updating the string on a CCLabelTTF doesn’t use release or retain I thought it should work?


The same problem as


Ok, so how come I can change the size of a sprite from the other thread but I cannot change the text in a label? What’s the difference? Thanks.


Can not use setTextureRect() on a sprite in a seperate thread either? How am I supposed to show a progress bar when my progress percent is coming from another thread?


You can try this …

int percent = 0;

void in_seperate_thread()
percent += 5;
if (percent == 100) closeThread();

void in_main_thread()

maybe have to lock/unlock percent, or not