12 func random_entre (begin, end int64) int64 {
13 random_byte := make([]byte, 1)
14 rand.Read(random_byte)
15 return int64(random_byte[0]) % (end - begin + 1) + begin
18 func random_sleep () {
19 time.Sleep(random_entre(0, MAX_SLEEP_TIME) * 10e7)
22 func signal (channel chan int) {
23 if len(channel) < cap(channel) || cap(channel) == 0 {
28 func wait (channel chan int) {
34 for count == BUFFER_SIZE {
39 if count < BUFFER_SIZE {
40 Println("produzindo:", i)
42 rear = (rear + 1) % BUFFER_SIZE
63 front = (front + 1) % BUFFER_SIZE
65 Println("\tconsumindo:", v)
87 buffer = make([]int, BUFFER_SIZE)