<commit_before>#include <evenk/synch.h>
#include <evenk/thread.h>

#include <iostream>

evenk::default_synch::lock_type lock;
evenk::default_synch::cond_var_type cond;

void
thread_routine()
{
	evenk::default_synch::lock_owner_type guard(lock);
	cond.notify_one(); // notify that the thread started
	cond.wait(guard);  // wait for test finish
}

void
print_affinity(const evenk::thread::cpuset_type &affinity)
{
	std::cout << affinity.size() << ":";
	for (std::size_t cpu = 0; cpu < affinity.size(); cpu++)
		std::cout << " " << cpu;
	std::cout << "\n";
}

int
main()
{
	evenk::default_synch::lock_owner_type guard(lock);
	evenk::thread thread(thread_routine);
	cond.wait(guard); // wait until the thread starts
	guard.unlock();

	{
		auto affinity = thread.affinity();
		print_affinity(affinity);

		for (std::size_t i = 0; i < affinity.size(); i++)
			affinity[i] = false;
		thread.affinity(affinity);
	}

	{
		auto affinity = thread.affinity();
		print_affinity(affinity);
	}

	guard.lock();
	cond.notify_one(); // notify about test finish
	guard.unlock();

	thread.join();

	return 0;
}
<commit_msg>Fix set affinity test<commit_after>#include <evenk/synch.h>
#include <evenk/thread.h>

#include <iostream>

evenk::default_synch::lock_type lock;
evenk::default_synch::cond_var_type cond;

void
thread_routine()
{
	evenk::default_synch::lock_owner_type guard(lock);
	cond.notify_one(); // notify that the thread started
	cond.wait(guard);  // wait for test finish
}

void
print_affinity(const evenk::thread::cpuset_type &affinity)
{
	std::cout << affinity.size() << ":";
	for (std::size_t cpu = 0; cpu < affinity.size(); cpu++)
		std::cout << " " << cpu;
	std::cout << "\n";
}

int
main()
{
	evenk::default_synch::lock_owner_type guard(lock);
	evenk::thread thread(thread_routine);
	cond.wait(guard); // wait until the thread starts
	guard.unlock();

	{
		auto affinity = thread.affinity();
		print_affinity(affinity);

		for (std::size_t i = 0; i < affinity.size(); i += 2)
			affinity[i] = false;
		thread.affinity(affinity);
	}

	{
		auto affinity = thread.affinity();
		print_affinity(affinity);
	}

	guard.lock();
	cond.notify_one(); // notify about test finish
	guard.unlock();

	thread.join();

	return 0;
}

{'fraction_non_alphanumeric': 0.16869643662607126, 'fraction_numerical': 0.0031574199368516014, 'mean_word_length': 4.836842105263158, 'pattern_counts': {'":': 2, '<': 33, '<?xml version=': 0, '>': 9, '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': '2318111', 'n_tokens_mistral': 858, 'n_tokens_neox': 789, 'n_words': 170}