This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class VolatileTest { | |
private static final int MAX_TASK_COUNT = 5; | |
private static volatile int tasks = 0; | |
public static void main(String[] args) { | |
new Employee().start(); | |
new Manager().start(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let range = 1..1000; | |
let result: i32 = range.filter(|num| num % 3 == 0 || num % 5 ==0).sum(); | |
println!("{}",result) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Fibonacci { | |
current: u64, | |
next: u64, | |
} | |
impl Iterator for Fibonacci { | |
type Item = u64; | |
fn next(&mut self) -> Option<u64> { | |
let t = self.current + self.next; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Window { | |
number_str: String, | |
window_size: i32, | |
current: i32, | |
} | |
impl Iterator for Window { | |
type Item = u64; | |
fn next(&mut self) -> Option<u64> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <errno.h> | |
#include <fcntl.h> | |
#include <grp.h> | |
#include <pwd.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/mman.h> |