diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
commit | ec05778d5718a7912e506764d443a78d6a6179e3 (patch) | |
tree | 78a9a01532180030c095acefc45763f07c14edb8 /src/tests/threadid.cpp | |
parent | b20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff) | |
download | libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2 libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip |
Converted tabs to spaces with tabconv.
Diffstat (limited to 'src/tests/threadid.cpp')
-rw-r--r-- | src/tests/threadid.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/tests/threadid.cpp b/src/tests/threadid.cpp index 9ff99df..dfea504 100644 --- a/src/tests/threadid.cpp +++ b/src/tests/threadid.cpp | |||
@@ -9,64 +9,64 @@ using namespace Bu; | |||
9 | class CopyThing | 9 | class CopyThing |
10 | { | 10 | { |
11 | public: | 11 | public: |
12 | CopyThing() | 12 | CopyThing() |
13 | { | 13 | { |
14 | TRACE(); | 14 | TRACE(); |
15 | tidHome = Thread::currentThread(); | 15 | tidHome = Thread::currentThread(); |
16 | } | 16 | } |
17 | 17 | ||
18 | CopyThing( const CopyThing &rSrc ) | 18 | CopyThing( const CopyThing &rSrc ) |
19 | { | 19 | { |
20 | TRACE(); | 20 | TRACE(); |
21 | tidHome = Thread::currentThread(); | 21 | tidHome = Thread::currentThread(); |
22 | sio << "Same thread? " << (tidHome == rSrc.tidHome) << sio.nl; | 22 | sio << "Same thread? " << (tidHome == rSrc.tidHome) << sio.nl; |
23 | } | 23 | } |
24 | 24 | ||
25 | void doThings() | 25 | void doThings() |
26 | { | 26 | { |
27 | TRACE(); | 27 | TRACE(); |
28 | if( tidHome != Thread::currentThread() ) | 28 | if( tidHome != Thread::currentThread() ) |
29 | sio << "Different threads, hard copy here." << sio.nl; | 29 | sio << "Different threads, hard copy here." << sio.nl; |
30 | else | 30 | else |
31 | sio << "Same thread, everything is cool." << sio.nl; | 31 | sio << "Same thread, everything is cool." << sio.nl; |
32 | } | 32 | } |
33 | 33 | ||
34 | private: | 34 | private: |
35 | ThreadId tidHome; | 35 | ThreadId tidHome; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | class SubThread : public Thread | 38 | class SubThread : public Thread |
39 | { | 39 | { |
40 | public: | 40 | public: |
41 | SubThread( CopyThing &src ) : | 41 | SubThread( CopyThing &src ) : |
42 | src( src ) | 42 | src( src ) |
43 | { | 43 | { |
44 | src.doThings(); | 44 | src.doThings(); |
45 | } | 45 | } |
46 | 46 | ||
47 | protected: | 47 | protected: |
48 | void run() | 48 | void run() |
49 | { | 49 | { |
50 | src.doThings(); | 50 | src.doThings(); |
51 | sio << "run-Child is me? " << (getId() == Thread::currentThread()) << sio.nl; | 51 | sio << "run-Child is me? " << (getId() == Thread::currentThread()) << sio.nl; |
52 | } | 52 | } |
53 | 53 | ||
54 | private: | 54 | private: |
55 | CopyThing src; | 55 | CopyThing src; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | int main( int argc, char *argv[] ) | 58 | int main( int argc, char *argv[] ) |
59 | { | 59 | { |
60 | CopyThing a; | 60 | CopyThing a; |
61 | 61 | ||
62 | SubThread st( a ); | 62 | SubThread st( a ); |
63 | st.start(); | 63 | st.start(); |
64 | 64 | ||
65 | sio << "Child is me? " << (st.getId() == Thread::currentThread()) << sio.nl; | 65 | sio << "Child is me? " << (st.getId() == Thread::currentThread()) << sio.nl; |
66 | 66 | ||
67 | st.join(); | 67 | st.join(); |
68 | 68 | ||
69 | 69 | ||
70 | return 0; | 70 | return 0; |
71 | } | 71 | } |
72 | 72 | ||