| 233 | PrintThread(csnd::Csound *csound) |
| 234 | : Thread(csound), spinlock(false), on(true), message("") {}; |
| 235 | uintptr_t run() { |
| 236 | std::string old; |
| 237 | while(on) { |
| 238 | lock(); |
| 239 | if(old.compare(message)) { |
| 240 | csound->message(message.c_str()); |
| 241 | old = message; |
| 242 | } |
| 243 | unlock(); |
| 244 | } |
| 245 | return 0; |
| 246 | } |
| 247 | void lock() { |
| 248 | while(spinlock == true) csound->sleep(1); |
| 249 | spinlock = true; |