* running until the function returns. You don't need to keep the thread
* object you want to wait() or kill() the thread later.
*/
* running until the function returns. You don't need to keep the thread
* object you want to wait() or kill() the thread later.
*/
/**
* Execute a function in a new thread.
* \param function The function to execute.
* \return The new thread, or an invalid thread if an error occurred.
*/
/**
* Execute a function in a new thread.
* \param function The function to execute.
* \return The new thread, or an invalid thread if an error occurred.
*/
- Function* fcopy = new Function(function);
- SDL_Thread* thread = SDL_CreateThread(&Thread::run, (void*)fcopy);
+ thread::function* fcopy = new thread::function(function);
+ SDL_Thread* thread = SDL_CreateThread(&thread::run, (void*)fcopy);
/**
* Get whether or not the task is done.
* \return True if the task is done, false otherwise.
*/
/**
* Get whether or not the task is done.
* \return True if the task is done, false otherwise.
*/
* A mutex to protect sensitive sections of code from threads which might
* otherwise cause unpredictable results.
*/
* A mutex to protect sensitive sections of code from threads which might
* otherwise cause unpredictable results.
*/
* Block until the calling thread can secure exclusive access to the
* code protected by the mutex.
* \return True if the lock was acquired, false otherwise.
* Block until the calling thread can secure exclusive access to the
* code protected by the mutex.
* \return True if the lock was acquired, false otherwise.
}
/**
* Unlock the mutex. Call this after the sensitive block of code to
* allow another thread to acquire the lock.
* \return True if the mutex was unlocked, false otherwise.
}
/**
* Unlock the mutex. Call this after the sensitive block of code to
* allow another thread to acquire the lock.
* \return True if the mutex was unlocked, false otherwise.
* deconstruction. Therefore, it's generally safer to use this method
* since it makes it much more difficult to forget to unlock a mutex.
*/
* deconstruction. Therefore, it's generally safer to use this method
* since it makes it much more difficult to forget to unlock a mutex.
*/
* Get whether or not the mutex is locked.
* \return True if the mutex is locked, false otherwise.
*/
* Get whether or not the mutex is locked.
* \return True if the mutex is locked, false otherwise.
*/
};
/**
* This type of lock tries to acquire a lock on the mutex during
* construction and releases the lock on deconstruction.
*/
};
/**
* This type of lock tries to acquire a lock on the mutex during
* construction and releases the lock on deconstruction.
*/
* Get whether or not the mutex is locked.
* \return True if the mutex is locked, false otherwise.
*/
* Get whether or not the mutex is locked.
* \return True if the mutex is locked, false otherwise.
*/
* \param mutex The mutex.
* \return True if the thread was notified, false otherwise.
*/
* \param mutex The mutex.
* \return True if the thread was notified, false otherwise.
*/
* \param timeout Number of seconds to wait.
* \return True if the thread was notified, false otherwise.
*/
* \param timeout Number of seconds to wait.
* \return True if the thread was notified, false otherwise.
*/
* \param timeout Number of seconds to wait.
* \return True if the thread was notified, false otherwise.
*/
* \param timeout Number of seconds to wait.
* \return True if the thread was notified, false otherwise.
*/
- return (SDL_CondWaitTimeout(mCondition,
- lock.mMutex.mMutex, ms) == 0);
+ return (SDL_CondWaitTimeout(condition_,
+ lock.mutex_.mutex_, ms) == 0);
}
/**
* Notify all other threads that are waiting on the condition.
* \return True on success, false otherwise.
*/
}
/**
* Notify all other threads that are waiting on the condition.
* \return True on success, false otherwise.
*/
* Block until the calling thread can secure exclusive access to the
* code protected by the semaphore.
* \return True if the lock was acquired, false otherwise.
* Block until the calling thread can secure exclusive access to the
* code protected by the semaphore.
* \return True if the lock was acquired, false otherwise.
* \param timeout Number of seconds to try.
* \return True if the lock was acquired, false otherwise.
*/
* \param timeout Number of seconds to try.
* \return True if the lock was acquired, false otherwise.
*/
}
/**
* Unlock the semaphore. Call this after the sensitive block of code
* to allow another thread to acquire the lock.
* \return True if the semaphore was unlocked, false otherwise.
}
/**
* Unlock the semaphore. Call this after the sensitive block of code
* to allow another thread to acquire the lock.
* \return True if the semaphore was unlocked, false otherwise.
* Get whether or not the semaphore is locked.
* \return True if the semaphore is locked, false otherwise.
*/
* Get whether or not the semaphore is locked.
* \return True if the semaphore is locked, false otherwise.
*/
};
/**
* This type of lock tries to acquire a lock on the semaphore during
* construction and releases the lock on deconstruction.
*/
};
/**
* This type of lock tries to acquire a lock on the semaphore during
* construction and releases the lock on deconstruction.
*/
* Get whether or not the semaphore is locked.
* \return True if the semaphore is locked, false otherwise.
*/
* Get whether or not the semaphore is locked.
* \return True if the semaphore is locked, false otherwise.
*/