Skip to content

A minimal implementation of a thread safe spin-lock using rust

Notifications You must be signed in to change notification settings

Harshit933/rust-spin_lock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spin Lock

A minimal implementation of a thread safe spin-lock using rust

Usage

  1. Create a new lock by using
let sl = SpinLock::new(Vec::new())
  1. You can lock this object by using .lock() method
sl.lock()
  1. Unlocking happens when the object gets destroyed so we don't need to explicitly call the .unlock() method.

NOTE: SpinLock is usually used on the threads which does not wait for long time on some stuff to happen. If your threads happens to wait for longer times while processing something, you should not consider using this. Instead you can use Mutex which could be found inside the standard library.

About

A minimal implementation of a thread safe spin-lock using rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages