<commit_before>// A simple semaphore primitive
//
// Usage:
//    sem := New(3)
//    for i := 0; i < 10; i++ {
//    	sem.Wait()
//    	go func() {
//    		time.Sleep(time.Second)
//    		sem.Signal()
//    	}()
//    }
package semaphore

type Semaphore chan struct{}

// Increments the `Semaphore` by 1
func (s Semaphore) Signal() {
	s <- struct{}{}
}


// Decrements the `Semaphore` by 1
func (s Semaphore) Wait() {
	<-s
}


// New returns an instance of a `Semaphore`:
//    sem := New(10)
func New(size int) Semaphore {
	sem := make(Semaphore, size)
	for i := 0; i < size; i++ {
		sem <- struct{}{}<commit_msg>Don't allocate memory to fill the semaphore channel<commit_after>// A simple semaphore primitive
//
// Usage:
//    sem := New(3)
//    for i := 0; i < 10; i++ {
//    	sem.Wait()
//    	go func() {
//    		time.Sleep(time.Second)
//    		sem.Signal()
//    	}()
//    }
package semaphore

type Semaphore chan struct{}

// Increments the `Semaphore` by 1
func (s Semaphore) Signal() {
	s <- struct{}{}
}


// Decrements the `Semaphore` by 1
func (s Semaphore) Wait() {
	<-s
}


// New returns an instance of a `Semaphore`:
//    sem := New(10)
func New(size int) Semaphore {
	sem := make(Semaphore, size)
	for _ := range make([]struct{}, size) {
		sem <- struct{}{}
{'fraction_non_alphanumeric': 0.18671875, 'fraction_numerical': 0.01328125, 'mean_word_length': 2.4069148936170213, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 3, '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': '4280737', 'n_tokens_mistral': 522, 'n_tokens_neox': 482, 'n_words': 144}