Subversion Repositories programming

Rev

Rev 328 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 328 Rev 329
Line 9... Line 9...
9
#include "elevator.h"
9
#include "elevator.h"
10
 
10
 
11
int main (int argc, char *argv[])
11
int main (int argc, char *argv[])
12
{
12
{
13
    int i = 0;
13
    int i = 0;
14
    Elevator e1 (10);
14
    //Elevator e1 (10);
15
    Controller c (10, 5);
15
    Controller c (10, 5);
16
 
16
 
17
    vector<Elevator> elevators (5, Elevator (10));
17
    vector<Elevator> elevators (5, Elevator (10));
18
 
18
 
19
    // start t1
19
    elevators[1].thread_start ();
20
    boost::thread t1 (boost::bind (e1.thread_entry, &e1));
20
    //elevators[2].thread_start ();
21
 
21
 
22
    // do some useful stuff here
22
    // do some useful stuff here
-
 
23
    sleep (2);
-
 
24
    elevators[1].push_button (4);
-
 
25
    //elevators[2].push_button (8);
-
 
26
    //elevators[2].push_button (2);
-
 
27
    sleep (24);
23
 
28
 
24
    // notify t1 that it needs to stop
29
    elevators[1].thread_exit ();
25
    e1.thread_exit ();
30
    //elevators[2].thread_exit ();
26
 
31
 
27
    // wait for t1 to stop
-
 
28
    t1.join ();
-
 
29
 
32
 
30
    return 0;
33
    return 0;
31
}
34
}
32
 
35