source: Sophya/trunk/SophyaExt/JThreadsC++/Examples/hello.cc@ 3885

Last change on this file since 3885 was 1016, checked in by ansari, 25 years ago

Creation du module JThreadsC++, importation du code des classes
de Thread a la Java de Object Oriented Concepts Inc - Reza 19/5/2000

File size: 1.0 KB
Line 
1// **********************************************************************
2//
3// Copyright (c) 2000
4// Object Oriented Concepts, Inc.
5// Billerica, MA, USA
6//
7// All Rights Reserved
8//
9// **********************************************************************
10#include <JTC/JTC.h>
11#include <stdlib.h>
12
13#ifdef HAVE_STD_IOSTREAM
14using namespace std;
15#endif
16
17//
18// This thread will display HelloWorld when started.
19//
20class HelloWorldThread : public JTCThread
21{
22public:
23 virtual void run()
24 {
25 cout << "hello world" << endl;
26 }
27};
28
29int
30main(int argc, char** argv)
31{
32 try
33 {
34 //
35 // A user of the JTC library must create an instance of this
36 // class to initialize the library.
37 //
38 JTCInitialize bootJTC(argc, argv);
39
40 //
41 // Create an instance of the HelloWorldThread object.
42 //
43 JTCThreadHandle t = new HelloWorldThread();
44
45 //
46 // Start the thread.
47 //
48 t -> start();
49 }
50 catch(const JTCException& e)
51 {
52 cerr << "JTCException: " << e.getMessage() << endl;
53 return EXIT_FAILURE;
54 }
55
56 return EXIT_SUCCESS;
57}
Note: See TracBrowser for help on using the repository browser.