Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Thread.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2004 University of Massachusetts.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010  */
00011 
00012 //
00013 // Thread
00014 //
00015 // 15 November 2004 -- tds
00016 //
00017 
00018 #ifndef INDRI_THREAD_HPP
00019 #define INDRI_THREAD_HPP
00020 
00021 #include "indri/indri-platform.h"
00022 
00023 #ifndef WIN32
00024 #include <pthread.h>
00025 #endif
00026 namespace indri
00027 {
00028   namespace thread
00029   {
00030     
00031     class Thread {
00032     private:
00033 #ifdef WIN32
00034       unsigned int _id;
00035       uintptr_t _thread;
00036 #else
00037       pthread_t _thread;
00038 #endif
00039       void (*_function)( void* data );
00040       void* _data;
00041 
00042     public:
00043       Thread( void (*function)(void*), void* data );
00044       void execute();
00045       void join();
00046 
00047       static int id();
00048       static void sleep( int milliseconds );
00049       static void yield();
00050     };
00051   }
00052 }
00053 
00054 #endif // INDRI_THREAD_HPP
00055 

Generated on Tue Jun 15 11:02:56 2010 for Lemur by doxygen 1.3.4