#ifndef __X10_COMPILER_WS_WORKER_H
#define __X10_COMPILER_WS_WORKER_H

#include <x10rt.h>


#define X10_LANG_OBJECT_H_NODEPS
#include <x10/lang/Object.h>
#undef X10_LANG_OBJECT_H_NODEPS
#define X10_LANG_INT_H_NODEPS
#include <x10/lang/Int.h>
#undef X10_LANG_INT_H_NODEPS
namespace x10 { namespace array { 
template<class TPMGL(T)> class Array;
} } 
namespace x10 { namespace util { 
class Random;
} } 
namespace x10 { namespace lang { 
class Int;
} } 
namespace x10 { namespace lang { 
class Deque;
} } 
namespace x10 { namespace util { namespace concurrent { 
class Lock;
} } } 
namespace x10 { namespace lang { 
class Throwable;
} } 
namespace x10 { namespace lang { 
class Long;
} } 
namespace x10 { namespace compiler { namespace ws { 
class RegularFrame;
} } } 
namespace x10 { namespace compiler { namespace ws { 
class Frame;
} } } 
namespace x10 { namespace compiler { 
class Ifdef;
} } 
namespace x10 { namespace lang { 
class Runtime;
} } 
namespace x10 { namespace compiler { namespace ws { 
class FinishFrame;
} } } 
namespace x10 { namespace compiler { 
class Abort;
} } 
namespace x10 { namespace lang { 
class Any;
} } 
namespace x10 { namespace lang { 
class String;
} } 
namespace x10 { namespace compiler { 
class NoReturn;
} } 
namespace x10 { namespace lang { 
class Place;
} } 
namespace x10 { namespace lang { 
class VoidFun_0_0;
} } 
namespace x10 { namespace compiler { 
class RemoteInvocation;
} } 
namespace x10 { namespace compiler { 
class AsyncClosure;
} } 
namespace x10 { namespace compiler { namespace ws { 
class MainFrame;
} } } 
namespace x10 { namespace lang { 
class Boolean;
} } 
namespace x10 { namespace compiler { 
class Finalization;
} } 
namespace x10 { namespace compiler { 
class CompilerFlags;
} } 
namespace x10 { namespace compiler { namespace ws { 

class Worker : public x10::lang::Object   {
    public:
    RTT_H_DECLS_CLASS
    
    x10aux::ref<x10::array::Array<x10aux::ref<x10::compiler::ws::Worker> > >
      FMGL(workers);
    
    x10aux::ref<x10::util::Random> FMGL(random);
    
    x10_int FMGL(id);
    
    x10aux::ref<x10::lang::Deque> FMGL(deque);
    
    x10aux::ref<x10::lang::Deque> FMGL(fifo);
    
    x10aux::ref<x10::util::concurrent::Lock> FMGL(lock);
    
    x10aux::ref<x10::lang::Throwable> FMGL(throwable);
    
    void _constructor(x10_int i, x10aux::ref<x10::array::Array<x10aux::ref<x10::compiler::ws::Worker> > > workers);
    
    static x10aux::ref<x10::compiler::ws::Worker> _make(x10_int i, x10aux::ref<x10::array::Array<x10aux::ref<x10::compiler::ws::Worker> > > workers);
    
    virtual void migrate();
    virtual void run();
    virtual x10aux::ref<x10::lang::Object> find();
    virtual void unroll(x10aux::ref<x10::compiler::ws::Frame> frame) X10_PRAGMA_NORETURN ;
    static void runAsyncAt(x10::lang::Place place, x10aux::ref<x10::compiler::ws::RegularFrame> frame);
    static void runAt(x10::lang::Place place, x10aux::ref<x10::compiler::ws::RegularFrame> frame) X10_PRAGMA_NORETURN ;
    static void stop();
    static x10aux::ref<x10::compiler::ws::Worker> startHere();
    static x10aux::ref<x10::compiler::ws::Worker> start();
    static void main(x10aux::ref<x10::compiler::ws::MainFrame> frame);
    virtual void rethrow();
    virtual x10aux::ref<x10::compiler::ws::Worker> x10__compiler__ws__Worker____x10__compiler__ws__Worker__this(
      );
    void __fieldInitializers41514();
    
    // Serialization
    public: static const x10aux::serialization_id_t _serialization_id;
    
    public: x10aux::serialization_id_t _get_serialization_id() {
         return _serialization_id;
    }
    
    public: virtual void _serialize_body(x10aux::serialization_buffer& buf);
    
    public: static x10aux::ref<x10::lang::Reference> _deserializer(x10aux::deserialization_buffer& buf);
    
    public: void _deserialize_body(x10aux::deserialization_buffer& buf);
    
};

} } } 
#endif // X10_COMPILER_WS_WORKER_H

namespace x10 { namespace compiler { namespace ws { 
class Worker;
} } } 

#ifndef X10_COMPILER_WS_WORKER_H_NODEPS
#define X10_COMPILER_WS_WORKER_H_NODEPS
#ifndef X10_COMPILER_WS_WORKER_H_GENERICS
#define X10_COMPILER_WS_WORKER_H_GENERICS
#endif // X10_COMPILER_WS_WORKER_H_GENERICS
#endif // __X10_COMPILER_WS_WORKER_H_NODEPS
