4 * PWLib application header file for ThreadSafe
6 * Copyright 2002 Equivalence
9 * Revision 1.6 2003/10/27 22:12:56 dereksmithies
10 * Add more good changes to get Compare method work. Thanks to Gene Small
12 * Revision 1.5 2003/10/13 23:38:31 dereksmithies
13 * Add debugging statements, usage(), Fixed Compare method. Thanks Gene Small.
15 * Revision 1.4 2002/12/11 03:38:35 robertj
18 * Revision 1.3 2002/12/02 01:08:29 robertj
19 * Updated to latest safe collection classes, thanks Vladimir Nesic
21 * Revision 1.2 2002/05/02 00:30:03 robertj
22 * Allowed for non-template containers
24 * Revision 1.1 2002/05/01 04:16:44 robertj
25 * Added thread safe collection classes.
29 #ifndef _ThreadSafe_MAIN_H
30 #define _ThreadSafe_MAIN_H
33 #include <ptlib/safecoll.h>
38 class TestObject
: public PSafeObject
40 PCLASSINFO(TestObject
, PSafeObject
);
42 TestObject(ThreadSafe
& process
, unsigned val
);
45 Comparison
Compare(const PObject
& obj
) const;
46 void PrintOn(ostream
& strm
) const;
53 class ThreadSafe
: public PProcess
55 PCLASSINFO(ThreadSafe
, PProcess
)
65 void Test1(PArgList
& args
);
67 void Test1OutputEnd();
68 PDECLARE_NOTIFIER(PThread
, ThreadSafe
, Test1Thread
);
70 void Test2(PArgList
& args
);
71 PDECLARE_NOTIFIER(PThread
, ThreadSafe
, Test2Thread1
);
72 PDECLARE_NOTIFIER(PThread
, ThreadSafe
, Test2Thread2
);
74 void Test3(PArgList
& args
);
75 PDECLARE_NOTIFIER(PThread
, ThreadSafe
, Test3Thread1
);
76 PDECLARE_NOTIFIER(PThread
, ThreadSafe
, Test3Thread2
);
78 PSafeList
<TestObject
> unsorted
;
79 PSafeSortedList
<TestObject
> sorted
;
80 PSafeDictionary
<POrdinalKey
, TestObject
> sparse
;
83 PTimeInterval startTick
;
85 unsigned totalObjects
;
86 unsigned currentObjects
;
88 friend class TestObject
;
92 #endif // _ThreadSafe_MAIN_H
95 // End of File ///////////////////////////////////////////////////////////////