<commit_before>#pragma once
#include "cocos2d.h"
#include "MoveAbleElemBaseFactory.h"
#include <thread>
#include <future>
#include <atomic>
#include <exception>
#include <iostream>

static std::atomic_flag s_lock = ATOMIC_FLAG_INIT;

#define INCREASEMENT 10

#define ADD_MOVEABLE_ELEM(SIZE) \
		for (size_t i = 0; i < SIZE; ++i)\
		{\
			_vUsedElem.push_back(MoveAbleElem::create()); \
		}

template<class MoveAbleElem>
class MoveAbleElemFactory :public MoveAbleElemBaseFactory
{
	typedef MoveAbleElem* MoveAbleElemPtr;
protected:
	MoveAbleElemFactory()
	{
		_pPreGenElem.clear();

		auto & _lock = s_lock;
		auto & _vUsedElem = this->_vUsedElem;
		//߳ȥɼأΨһ
		_theadPreload = std::async(
			[&_lock, &_vUsedElem]()->void
		{
			while (_lock.test_and_set(std::memory_order_acquire))
			{
				//ȡ
			}
			ADD_MOVEABLE_ELEM(INCREASEMENT * 2);
			_lock.clear();
			//
		}
		);
	}
public:
	<commit_msg>improved pre create MoveAbleElems<commit_after>#pragma once
#include "cocos2d.h"
#include "MoveAbleElemBaseFactory.h"
#include <thread>
#include <future>
#include <atomic>
#include <exception>
#include <iostream>

static std::atomic_flag s_lock = ATOMIC_FLAG_INIT;

#define INCREASEMENT 5
#define PRE_CREATE_INCREASEMENT 30

#define ADD_MOVEABLE_ELEM(SIZE) \
		for (size_t i = 0; i < SIZE; ++i)\
		{\
			_vUsedElem.push_back(MoveAbleElem::create()); \
		}

template<class MoveAbleElem>
class MoveAbleElemFactory :public MoveAbleElemBaseFactory
{
	typedef MoveAbleElem* MoveAbleElemPtr;
protected:
	MoveAbleElemFactory()
	{
		_pPreGenElem.clear();

		auto & _lock = s_lock;
		auto & _vUsedElem = this->_vUsedElem;
		//߳ȥɼأΨһ
		_theadPreload = std::async(
			[&_lock, &_vUsedElem]()->void
		{
			while (_lock.test_and_set(std::memory_order_acquire))
			{
				//ȡ
			}
			ADD_MOVEABLE_ELEM(PRE_CREATE_INCREASEMENT);
			_lock.clear();
			//
		}
		);
	}
public:
	
{'fraction_non_alphanumeric': 0.13153638814016172, 'fraction_numerical': 0.005390835579514825, 'mean_word_length': 4.6072507552870094, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3282646', 'n_tokens_mistral': 826, 'n_tokens_neox': 745, 'n_words': 131}