changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / Base / Threading / testGlobalThreadElems.cpp
bloba17ad167bee90789253a0c2f3e4b05820adaaf81
2 #if __GNUC__ >= 4 || __GNUC_MINOR__ >=3
3 #pragma GCC diagnostic warning "-Wunused-variable"
4 #endif
6 #include "OSGBaseInitFunctions.h"
7 #include "OSGThreadManager.h"
8 #include "OSGThread.h"
9 #include "OSGBarrier.h"
12 //template<class ElemType>
13 // void (OSG::ThreadManager::*RemoveElemF)(ElemType *) >
14 template<class ElemType>
15 void doIt(void)
17 typedef OSG::RefCountPtr<ElemType,
18 OSG::MemObjRefCountPolicy> ElemTypeRefPtr;
20 fprintf(stderr, "====================================================\n");
21 OSG::ThreadManager::the()->dump();
23 ElemTypeRefPtr pElem = ElemType::get("test1", true);
25 fprintf(stderr, "%p \n", pElem.get());
27 fprintf(stderr, "====================================================\n");
28 OSG::ThreadManager::the()->dump();
30 OSG::ThreadManager::the()->remove(pElem);
32 fprintf(stderr, "%p \n", pElem.get());
34 fprintf(stderr, "====================================================\n");
35 OSG::ThreadManager::the()->dump();
37 pElem = NULL;
39 fprintf(stderr, "====================================================\n");
40 OSG::ThreadManager::the()->dump();
43 fprintf(stderr, "====================================================\n");
44 fprintf(stderr, "====================================================\n");
45 fprintf(stderr, "====================================================\n");
46 OSG::ThreadManager::the()->dump();
48 pElem = ElemType::get("test1", false);
50 fprintf(stderr, "%p \n", pElem.get());
52 fprintf(stderr, "====================================================\n");
53 OSG::ThreadManager::the()->dump();
55 OSG::ThreadManager::the()->remove(pElem);
57 fprintf(stderr, "%p \n", pElem.get());
59 fprintf(stderr, "====================================================\n");
60 OSG::ThreadManager::the()->dump();
62 pElem = NULL;
64 fprintf(stderr, "====================================================\n");
65 OSG::ThreadManager::the()->dump();
68 fprintf(stderr, "====================================================\n");
69 fprintf(stderr, "====================================================\n");
70 fprintf(stderr, "====================================================\n");
71 OSG::ThreadManager::the()->dump();
73 pElem = ElemType::get("test1", true);
75 fprintf(stderr, "%p \n", pElem.get());
77 fprintf(stderr, "====================================================\n");
78 OSG::ThreadManager::the()->dump();
81 // OSG::ThreadManager::the()->remove(pElem);
83 pElem = NULL;
85 fprintf(stderr, "%p \n", pElem.get());
87 fprintf(stderr, "====================================================\n");
88 OSG::ThreadManager::the()->dump();
90 pElem = ElemType::find("test1");
92 fprintf(stderr, "%p \n", pElem.get());
94 fprintf(stderr, "====================================================\n");
95 OSG::ThreadManager::the()->dump();
97 OSG::ThreadManager::the()->remove(pElem);
99 fprintf(stderr, "====================================================\n");
100 OSG::ThreadManager::the()->dump();
102 pElem = NULL;
104 fprintf(stderr, "====================================================\n");
105 OSG::ThreadManager::the()->dump();
108 int main (int argc, char **argv)
110 OSG::osgInit(argc, argv);
112 doIt<OSG::BaseThread>();
113 doIt<OSG::Lock>();
114 doIt<OSG::LockPool>();
115 doIt<OSG::Barrier>();
116 doIt<OSG::CondVar>();
117 doIt<OSG::Semaphore>();
119 doIt<OSG::Thread>();
121 OSG::osgExit();