mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
+ Got rid of zip lib requirement in G3D...
Still can re-enable code by defining _HAVE_ZIP...
+ Remove silly X11 lib dependency from G3D
Code doesn't seem to do anything yet anyway, and even if, we don't want it :p
+ Fix another weird G3D build problem...
+ Remove some __asm usage in g3d, which is not available on Win64
My editor also decided to remove a ton of trailing white spaces...tss...
+ Reapply G3D fixes for 64bit VC
+ not use SSE specific header when SSE not enabled in *nix
+ Updated project files
+ New vmap_assembler VC90/VC80 Project
+ vmap assembler binaries updates
NOTE: Old vmap fikes expected work (as tests show) with new library version.
But better use new generated versions. Its different in small parts to bad or good...
(based on Lynx3d's repo commit 44798d3)
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
87 lines
2.5 KiB
C++
87 lines
2.5 KiB
C++
#ifndef G3D_THREADSET_H
|
|
#define G3D_THREADSET_H
|
|
|
|
#include "G3D/platform.h"
|
|
#include "G3D/Array.h"
|
|
#include "G3D/ReferenceCount.h"
|
|
#include "G3D/GThread.h"
|
|
#include "G3D/GMutex.h"
|
|
|
|
namespace G3D {
|
|
|
|
/** Manages a set of threads. All methods are threadsafe except for
|
|
the iterator begin/end.
|
|
|
|
@beta*/
|
|
class ThreadSet : public ReferenceCountedObject {
|
|
public:
|
|
/** Intended to allow future use with a template parameter.*/
|
|
typedef GThread Thread;
|
|
|
|
typedef ReferenceCountedPointer<Thread> ThreadRef;
|
|
typedef ReferenceCountedPointer<ThreadSet> Ref;
|
|
typedef Array<ThreadRef>::Iterator Iterator;
|
|
typedef Array<ThreadRef>::ConstIterator ConstIterator;
|
|
|
|
private:
|
|
|
|
/** Protects m_thread */
|
|
GMutex m_lock;
|
|
|
|
/** Threads in the set */
|
|
Array<ThreadRef> m_thread;
|
|
|
|
public:
|
|
|
|
/** Total number of threads (some of which may be completed). */
|
|
int size() const;
|
|
|
|
/** Number of threads that have been started */
|
|
int numStarted() const;
|
|
|
|
/** Start all threads that are not currently started.
|
|
|
|
@param lastThreadBehavior If USE_CURRENT_THREAD, takes the last unstarted thread and executes it manually on
|
|
the current thread. This helps to take full advantage of the machine when
|
|
running a large number of jobs and avoids the overhead of a thread start for single-thread groups.
|
|
Note that this forces start() to block until
|
|
that thread is complete.
|
|
*/
|
|
void start(GThread::SpawnBehavior lastThreadBehavior = GThread::USE_NEW_THREAD) const;
|
|
|
|
/** Terminate all threads that are currently started */
|
|
void terminate() const;
|
|
|
|
/** Waits until all started threads have completed. */
|
|
void waitForCompletion() const;
|
|
|
|
/** Remove all (not stopping them) */
|
|
void clear();
|
|
|
|
/** Removes completed threads and returns the new size.*/
|
|
int removeCompleted();
|
|
|
|
/** Inserts a new thread, if it is not already present, and
|
|
returns the new number of threads.*/
|
|
int insert(const ThreadRef& t);
|
|
|
|
/** Removes a thread. Returns true if the thread was present and
|
|
removed. */
|
|
bool remove(const ThreadRef& t);
|
|
|
|
bool contains(const ThreadRef& t) const;
|
|
|
|
/** It is an error to mutate the ThreadSet while iterating through it. */
|
|
Iterator begin();
|
|
|
|
Iterator end();
|
|
|
|
ConstIterator begin() const;
|
|
|
|
ConstIterator end() const;
|
|
};
|
|
|
|
|
|
} // namespace G3D
|
|
|
|
#endif
|