Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改mutex为boost::mutex,否则Linux下面无法编译 #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions source/Linux/xtp_api_python3_2.2.33.5/vnxtpquote/vnxtpquote.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ class ConcurrentQueue
{
private:
queue<Data> the_queue; //��׼�����
mutable mutex the_mutex; //boost������
mutable boost::mutex the_mutex; //boost������
condition_variable the_condition_variable; //boost��������

public:

//�����µ�����
void push(Data const& data)
{
mutex::scoped_lock lock(the_mutex); //��ȡ������
boost::mutex::scoped_lock lock(the_mutex); //��ȡ������
the_queue.push(data); //������������
lock.unlock(); //�ͷ���
the_condition_variable.notify_one(); //֪ͨ���������ȴ����߳�
Expand All @@ -130,14 +130,14 @@ class ConcurrentQueue
//�������Ƿ�Ϊ��
bool empty() const
{
mutex::scoped_lock lock(the_mutex);
boost::mutex::scoped_lock lock(the_mutex);
return the_queue.empty();
}

//ȡ��
Data wait_and_pop()
{
mutex::scoped_lock lock(the_mutex);
boost::mutex::scoped_lock lock(the_mutex);

while (the_queue.empty()) //������Ϊ��ʱ
{
Expand Down
18 changes: 9 additions & 9 deletions source/Linux/xtp_api_python3_2.2.33.5/vnxtptrader/vnxtptrader.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ struct Task
int64_t addtional_int_four; //���������ֶ�

int64_t req_count;
int64_t order_sequence;
int64_t order_sequence;
int64_t query_reference;
int64_t trade_sequence;

Expand All @@ -152,15 +152,15 @@ class ConcurrentQueue
{
private:
queue<Data> the_queue; //��׼�����
mutable mutex the_mutex; //boost������
mutable boost::mutex the_mutex; //boost������
condition_variable the_condition_variable; //boost��������

public:

//�����µ�����
void push(Data const& data)
{
mutex::scoped_lock lock(the_mutex); //��ȡ������
boost::mutex::scoped_lock lock(the_mutex); //��ȡ������
the_queue.push(data); //������������
lock.unlock(); //�ͷ���
the_condition_variable.notify_one(); //֪ͨ���������ȴ����߳�
Expand All @@ -169,14 +169,14 @@ class ConcurrentQueue
//�������Ƿ�Ϊ��
bool empty() const
{
mutex::scoped_lock lock(the_mutex);
boost::mutex::scoped_lock lock(the_mutex);
return the_queue.empty();
}

//ȡ��
Data wait_and_pop()
{
mutex::scoped_lock lock(the_mutex);
boost::mutex::scoped_lock lock(the_mutex);

while (the_queue.empty()) //������Ϊ��ʱ
{
Expand Down Expand Up @@ -910,7 +910,7 @@ class TraderApi : public XTP::API::TraderSpi
virtual void onQueryOrderByPageEx(dict data, int64_t req_count, int64_t order_sequence, int64_t query_reference, int reqid, bool last, uint64_t session) {};

virtual void onQueryTradeByPage(dict data, int64_t req_count, int64_t trade_sequence, int64_t query_reference, int reqid, bool last, uint64_t session) {};

virtual void onCreditCashRepayDebtInterestFee(dict data, dict error_info, uint64_t session) {};


Expand Down Expand Up @@ -946,7 +946,7 @@ class TraderApi : public XTP::API::TraderSpi
//////////////algo////////

virtual void onQueryStrategy(dict data, string strategy_param, dict error_info, int32_t request_id, bool is_last, uint64_t session_id){};

virtual void onStrategyStateReport(dict data, uint64_t session_id){};

virtual void onALGOUserEstablishChannel(string user,dict error_info, uint64_t session_id){};
Expand Down Expand Up @@ -1009,7 +1009,7 @@ class TraderApi : public XTP::API::TraderSpi
int queryOrderByXTPIDEx(uint64_t orderid, uint64_t sessionid, int reqid);

int queryOrders(dict req, uint64_t sessionid, int reqid);

int queryOrdersEx(dict req, uint64_t sessionid, int reqid);

int queryUnfinishedOrders(uint64_t sessionid, int reqid);
Expand Down Expand Up @@ -1115,7 +1115,7 @@ class TraderApi : public XTP::API::TraderSpi
int queryOtherServerFund(dict req, uint64_t session_id, int request_id);

/////////////////////algo///////////////////////

int loginALGO(string ip, int port, string user, string password, int socktype,string local_ip);

int queryStrategy(uint32_t strategy_type, uint64_t client_strategy_id, uint64_t xtp_strategy_id, uint64_t session_id, int32_t request_id);
Expand Down