~ubuntu-branches/ubuntu/karmic/ugene/karmic

« back to all changes in this revision

Viewing changes to src/plugins_3rdparty/uhmmer/src/TaskLocalStorage.h

  • Committer: Bazaar Package Importer
  • Author(s): Ivan Efremov
  • Date: 2009-01-26 19:17:51 UTC
  • Revision ID: james.westby@ubuntu.com-20090126191751-9kqqevd3yf4o098r
Tags: upstream-1.3.2+repack
ImportĀ upstreamĀ versionĀ 1.3.2+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************
 
2
* Unipro UGENE - Integrated Bioinformatics Suite
 
3
* Copyright (C) 2008 Unipro, Russia (http://ugene.unipro.ru)
 
4
* All Rights Reserved
 
5
 
6
*     This source code is distributed under the terms of the
 
7
*     GNU General Public License. See the files COPYING and LICENSE
 
8
*     for details.
 
9
*****************************************************************/
 
10
 
 
11
#ifndef _TASK_LOCAL_CONTEXT_
 
12
#define _TASK_LOCAL_CONTEXT_
 
13
 
 
14
#include <hmmer2/funcs.h>
 
15
 
 
16
#include <QtCore/QThreadStorage>
 
17
#include <QtCore/QHash>
 
18
#include <QtCore/QMutex>
 
19
 
 
20
namespace GB2 {
 
21
 
 
22
// this struct is stored in TLS
 
23
struct ContextIdContainer {
 
24
    ContextIdContainer(qint64 id) : contextId(id){}
 
25
    qint64 contextId;
 
26
};
 
27
 
 
28
 
 
29
class TaskLocalData {
 
30
public:
 
31
    static HMMERTaskLocalData* current();
 
32
 
 
33
    // initializes HMMContext for current thread
 
34
    static void initializeHMMContext(qint64 contextId);
 
35
 
 
36
    // binds to existing HMMContext 
 
37
    static void bindToHMMContext(qint64 contextId);
 
38
 
 
39
    static qint64 detachFromHMMContext();
 
40
 
 
41
    static void freeHMMContext();
 
42
 
 
43
private:
 
44
    static QHash<qint64, struct HMMERTaskLocalData*> data;
 
45
    static QThreadStorage<ContextIdContainer*> tls;
 
46
    static QMutex mutex;
 
47
};
 
48
} //namespace
 
49
 
 
50
#endif
 
 
b'\\ No newline at end of file'