| 99 | } |
| 100 | |
| 101 | bool waitFinished() { |
| 102 | |
| 103 | |
| 104 | #ifdef _WIN32 |
| 105 | //x32 Windows definitions |
| 106 | Sleep(WAIT_USECONDS); |
| 107 | #else |
| 108 | //other platforms |
| 109 | usleep(WAIT_USECONDS); |
| 110 | #endif |
| 111 | |
| 112 | usleep(WAIT_USECONDS); |
| 113 | pthread_mutex_lock(&mp); |
| 114 | if (state == FINISHED) { |
| 115 | pthread_mutex_unlock(&mp); |
| 116 | return true; |
| 117 | } |
| 118 | pthread_mutex_unlock(&mp); |
| 119 | return false; |
| 120 | } |
| 121 | |
| 122 | unsigned int getNumber() const {return num;} |
| 123 | pthread_t getThreadSelf() const {return tid;} |