use std::mem;
use std::sync::Mutex;
use std::sync::atomic::AtomicI32;
use std::sync::atomic::Ordering;
fn main() {
let protect_me = AtomicI32::new(0);
let m = Mutex::new(());
crossbeam::scope(|s| {
let t = s.spawn(|_| {
let mut break_loop = false;
while !break_loop {
let guard = m.lock().unwrap();
println!("test {}", protect_me.load(Ordering::Relaxed));
if protect_me.load(Ordering::Relaxed) >= 1000 {
break_loop = true;
}
mem::drop(guard); // optional
}
});
while protect_me.load(Ordering::Relaxed) < 1000 {
let guard = m.lock().unwrap();
protect_me.store(protect_me.load(Ordering::Relaxed) + 1, Ordering::Relaxed);
mem::drop(guard); // optional
}
t.join().unwrap(); // optional
}).unwrap();
}
crossbeam = "0.8.1"
in Cargo.tomluse std::mem;
use std::sync::Mutex;
use std::sync::atomic::AtomicI32;
use std::sync::atomic::Ordering;
fn main() {
let protect_me = AtomicI32::new(0);
let m = Mutex::new(());
crossbeam::scope(|s| {
let t = s.spawn(|_| {
let mut break_loop = false;
while !break_loop {
let guard = m.lock().unwrap();
println!("test {}", protect_me.load(Ordering::Relaxed));
if protect_me.load(Ordering::Relaxed) >= 1000 {
break_loop = true;
}
mem::drop(guard); // optional
}
});
while protect_me.load(Ordering::Relaxed) < 1000 {
let guard = m.lock().unwrap();
protect_me.store(protect_me.load(Ordering::Relaxed) + 1, Ordering::Relaxed);
mem::drop(guard); // optional
}
t.join().unwrap(); // optional
}).unwrap();
}
use std::cell::UnsafeCell;
use std::mem;
use std::ops;
use std::sync;
pub struct WeirdMutex<T> {
mutex: sync::Mutex<()>,
data: UnsafeCell<T>,
}
pub struct WeirdMutexGuard<'a, T> {
_guard: sync::MutexGuard<'a, ()>,
data: &'a mut T,
}
pub struct WeirdMutexRo<'a, T> {
inner: &'a WeirdMutex<T>,
}
pub struct WeirdMutexRoGuard<'a, T> {
_guard: sync::MutexGuard<'a, ()>,
data: &'a T,
}
unsafe impl<'a, T> Send for WeirdMutexRo<'a, T> {}
unsafe impl<'a, T> Sync for WeirdMutexRo<'a, T> {}
impl<T> ops::Deref for WeirdMutex<T> {
type Target = T;
fn deref(&self) -> &T {
unsafe { &*self.data.get() }
}
}
impl<T> WeirdMutex<T> {
pub fn new(data: T) -> WeirdMutex<T> {
WeirdMutex {
mutex: sync::Mutex::new(()),
data: UnsafeCell::new(data),
}
}
pub fn lock<'a>(&'a self) -> WeirdMutexGuard<'a, T> {
WeirdMutexGuard {
_guard: self.mutex.lock().unwrap_or_else(|p| p.into_inner()),
data: unsafe { &mut *self.data.get() },
}
}
pub fn ro<'a>(&'a self) -> WeirdMutexRo<'a, T> {
WeirdMutexRo {
inner: self,
}
}
}
impl<'a, T> ops::Deref for WeirdMutexGuard<'a, T> {
type Target = T;
fn deref(&self) -> &T {
self.data
}
}
impl<'a, T> ops::DerefMut for WeirdMutexGuard<'a, T> {
fn deref_mut(&mut self) -> &mut T {
self.data
}
}
impl<'a, T> WeirdMutexRo<'a, T> {
pub fn lock(&self) -> WeirdMutexRoGuard<'a, T> {
WeirdMutexRoGuard {
_guard: self.inner.mutex.lock().unwrap_or_else(|p| p.into_inner()),
data: unsafe { &*self.inner.data.get() },
}
}
}
impl<'a, T> ops::Deref for WeirdMutexRoGuard<'a, T> {
type Target = T;
fn deref(&self) -> &T {
self.data
}
}
fn main() {
let protect_me = WeirdMutex::new(0);
crossbeam::scope(|s| {
let ro = protect_me.ro();
let t = s.spawn(move |_| {
let mut break_loop = false;
while !break_loop {
let guard = ro.lock();
println!("test {}", *guard);
if *guard >= 1000 {
break_loop = true;
}
mem::drop(guard); // optional
}
});
while *protect_me < 1000 {
let mut guard = protect_me.lock();
*guard += 1;
mem::drop(guard); // optional
}
t.join().unwrap(); // optional
}).unwrap();
}
types/ddmax/maps/Deadline 1.map
types/ddmax/maps/Get The Gifts.map
types/ddmax/maps/NUT_hardcore_race2.map
types/ddmax/maps/NUT Hardcore UNITED.map
types/ddmax/maps/NUT_race7.map
types/oldschool/maps/Crimson.map
types/oldschool/maps/Hardstyle 2.map
types/solo/maps/mazepack.map
clampf(r, 0.f, 1.f);
clampf(g, 0.f, 1.f);
clampf(b, 0.f, 1.f);
clampf(a, 0.f, 1.f);
m_aColor[pArray[i].m_Index].r = (unsigned char)(r * 255.f);
m_aColor[pArray[i].m_Index].g = (unsigned char)(g * 255.f);
m_aColor[pArray[i].m_Index].b = (unsigned char)(b * 255.f);
m_aColor[pArray[i].m_Index].a = (unsigned char)(a * 255.f);
SetColorVertex
, then it should already have calculated the influence of the envelope, no?"types/brutal/maps/Agony.map"
"types/brutal/maps/Aim 11.0.map"
"types/brutal/maps/Aim 8.0.map"
"types/brutal/maps/Childs Play 1.map"
"types/brutal/maps/Nightly Tandem.map"
"types/brutal/maps/Space & Time 2.map"
"types/brutal/maps/Space & Time.map"
"types/ddmax/maps/Blue Sky.map"
"types/ddmax/maps/Cigarette.map"
"types/ddmax/maps/DeadEnd.map"
/usr/bin/ld: CMakeFiles/DDNet.dir/src/engine/client/client.cpp.o: in function
CClient::MapDownloadTotalsize() const':
client.cpp:(.text._ZNK7CClient20MapDownloadTotalsizeEv[_ZNK7CClient20MapDownloadTotalsizeEv]+0x30): undefined reference to __atomic_load_8'
/usr/bin/ld: CMakeFiles/DDNet.dir/src/engine/client/client.cpp.o: in function
CClient::MapDownloadAmount() const':
client.cpp:(.text._ZNK7CClient17MapDownloadAmountEv[_ZNK7CClient17MapDownloadAmountEv]+0x30): undefined reference...|
might be above itelse if(AlignVertically == 1)
{
AlignmentVert = pRect->y;
}
to DoLabelpRect->
data/tools/
data/
data/map-testing
^^check_ddnet -> /home/teeworlds/.cargo/bin/check_ddnet
cargo install
then?cargo install --path=.
is correct iirc