#ifndef __X10_LANG_RUNTIME__WORKER_H
#define __X10_LANG_RUNTIME__WORKER_H

#include <x10rt.h>


#define X10_LANG_THREAD_H_NODEPS
#include <x10/lang/Thread.h>
#undef X10_LANG_THREAD_H_NODEPS
#define X10_IO_CUSTOMSERIALIZATION_H_NODEPS
#include <x10/io/CustomSerialization.h>
#undef X10_IO_CUSTOMSERIALIZATION_H_NODEPS
#define X10_LANG_INT_H_NODEPS
#include <x10/lang/Int.h>
#undef X10_LANG_INT_H_NODEPS
namespace x10 { namespace lang { 
class Int;
} } 
namespace x10 { namespace lang { 
class Activity;
} } 
namespace x10 { namespace lang { 
class Deque;
} } 
namespace x10 { namespace util { 
class Random;
} } 
namespace x10 { namespace lang { 
class String;
} } 
namespace x10 { namespace lang { 
class Long;
} } 
namespace x10 { namespace lang { 
class Object;
} } 
namespace x10 { namespace lang { 
class Throwable;
} } 
namespace x10 { namespace lang { 
class Runtime;
} } 
namespace x10 { namespace lang { 
class Any;
} } 
namespace x10 { namespace compiler { 
class Finalization;
} } 
namespace x10 { namespace compiler { 
class Abort;
} } 
namespace x10 { namespace compiler { 
class CompilerFlags;
} } 
namespace x10 { namespace lang { 
class Runtime__Pool;
} } 
namespace x10 { namespace lang { 
class Boolean;
} } 
namespace x10 { namespace util { namespace concurrent { 
class SimpleLatch;
} } } 
namespace x10 { namespace io { 
class SerialData;
} } 
namespace x10 { namespace lang { 
class UnsupportedOperationException;
} } 
namespace x10 { namespace compiler { 
class Pinned;
} } 
namespace x10 { namespace lang { 

class Runtime__Worker : public x10::lang::Thread   {
    public:
    RTT_H_DECLS_CLASS
    
    static x10aux::itable_entry _itables[3];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    static x10::io::CustomSerialization::itable<x10::lang::Runtime__Worker > _itable_0;
    
    static x10::lang::Any::itable<x10::lang::Runtime__Worker > _itable_1;
    
    static x10_int FMGL(BOUND);
    
    static x10_int FMGL(BOUND__get)();
    x10aux::ref<x10::lang::Activity> FMGL(activity);
    
    x10aux::ref<x10::lang::Deque> FMGL(queue);
    
    x10aux::ref<x10::util::Random> FMGL(random);
    
    x10_int FMGL(workerId);
    
    x10aux::ref<x10::lang::Deque> FMGL(wsfifo);
    
    void _constructor(x10_int workerId);
    
    static x10aux::ref<x10::lang::Runtime__Worker> _make(x10_int workerId);
    
    virtual x10_int size();
    virtual x10aux::ref<x10::lang::Activity> activity();
    virtual x10aux::ref<x10::lang::Activity> poll();
    virtual x10aux::ref<x10::lang::Activity> steal();
    virtual void push(x10aux::ref<x10::lang::Activity> activity);
    virtual void __apply();
    x10_boolean loop();
    virtual void probe();
    virtual void join(x10aux::ref<x10::util::concurrent::SimpleLatch> latch);
    x10_boolean loop2(x10aux::ref<x10::util::concurrent::SimpleLatch> latch);
    static void park();
    virtual void unpark();
    virtual x10aux::ref<x10::io::SerialData> serialize();
    void _constructor(x10aux::ref<x10::io::SerialData> a);
    
    static x10aux::ref<x10::lang::Runtime__Worker> _make(x10aux::ref<x10::io::SerialData> a);
    
    virtual x10aux::ref<x10::lang::Runtime__Worker> x10__lang__Runtime__Worker____x10__lang__Runtime__Worker__this(
      );
    void __fieldInitializers44656();
    
    // 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_LANG_RUNTIME__WORKER_H

namespace x10 { namespace lang { 
class Runtime__Worker;
} } 

#ifndef X10_LANG_RUNTIME__WORKER_H_NODEPS
#define X10_LANG_RUNTIME__WORKER_H_NODEPS
#ifndef X10_LANG_RUNTIME__WORKER_H_GENERICS
#define X10_LANG_RUNTIME__WORKER_H_GENERICS
inline x10_int x10::lang::Runtime__Worker::FMGL(BOUND__get)() {
    return x10::lang::Runtime__Worker::FMGL(BOUND);
}

#endif // X10_LANG_RUNTIME__WORKER_H_GENERICS
#endif // __X10_LANG_RUNTIME__WORKER_H_NODEPS
