Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

core: remove lock from c api #177

Merged
merged 1 commit into from
Oct 20, 2018
Merged

Conversation

shengofsun
Copy link
Contributor

the lock related code was scattered in different place:

  1. task.h : lock checker utility
  2. service_api_c.h : the c interface
  3. zlocks.h : c++ wrapper of lock objects
  4. tool_api.h: lock provider registry

now place them together, do some small modification and add some comments.

*/
class zlock
class ilock;
class zlock : private boost::noncopyable
Copy link
Contributor

@neverchanje neverchanje Oct 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

显式定义 noncopyable 吧也没两行代码,其实有些版本的 boost/noncopyable.hpp 会引入 boost/config.hpp,挺大的一个头文件依赖,我以前也用这个,后来就不用了

public:
    // disallow copy and assign
    zlock(const zlock &) = delete;
    zlock &operator=(const zlock &) = delete;

@shengofsun
Copy link
Contributor Author

@neverchanje 把boost的依赖删了

#ifndef MACROS_H
#define MACROS_H

#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个直接放在unitity/ports.h文件中就好了,就不用单独增加一个macros.h文件了。
就像 GTEST_DISALLOW_COPY_AND_ASSIGN_ 宏也是放在 gtest-port.h 中一样。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是这个理没错

Copy link
Contributor Author

@shengofsun shengofsun Oct 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

主要是人家的DISALLOW_COPY_AND_ASSIGN都是portable的,我们这个不是portable的……
再说,也有其他项目port和非port的宏分开啊。

anyway, 我挪过去吧

@shengofsun
Copy link
Contributor Author

the disallow copy thing has fixed. @qinzuoyan @neverchanje

@neverchanje neverchanje merged commit f2beade into XiaoMi:master Oct 20, 2018
vagetablechicken pushed a commit to vagetablechicken/rdsn that referenced this pull request Nov 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants