WIP/cpp -> next #31

닫힘
crtxcr "WIP/cpp 에서 next 로 16 commits 를 머지하려 합니다"
2개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
Showing only changes of commit 72a3b041d9 - Show all commits

파일 보기

@ -119,7 +119,7 @@ static int do_clone(int (*clonefn)(void *), void *launcharg)
}
template<typename T, typename U, typename ... Args>
T exile_launch_trivial(struct exile_policy *policy, U fn, Args && ... args)
typename std::enable_if_t<std::is_trivially_copyable_v<T>, T> exile_launch(struct exile_policy *policy, U fn, Args && ... args)
{
size_t mapsize = sizeof(T);
T * sharedbuf = (T *) mmap(NULL, mapsize , PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
@ -145,7 +145,8 @@ T exile_launch_trivial(struct exile_policy *policy, U fn, Args && ... args)
template<typename T, typename U, typename ... Args>
T exile_launch(struct exile_policy *policy, const std::function<size_t (const T &, char *, size_t)> &serializer, const std::function<T(const char *, size_t)> &deserializer, U fn, Args && ... args)
typename std::enable_if_t<!std::is_trivially_copyable_v<T> && std::is_copy_constructible_v<T>, T>
exile_launch(struct exile_policy *policy, const std::function<size_t (const T &, char *, size_t)> &serializer, const std::function<T(const char *, size_t)> &deserializer, U fn, Args && ... args)
{
size_t mapsize = EXILE_MMAP_SIZE;
char *sharedbuf = (char *) mmap(NULL, mapsize , PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);

파일 보기

@ -35,7 +35,7 @@ int incrementer(int arg)
int test_exile_launch_trivial()
{
int u = 22;
int result = exile_launch_trivial<int>(exile_init_policy(), &incrementer, u);
int result = exile_launch<int>(exile_init_policy(), &incrementer, u);
assert(result == 23);
return 0;
}