Skip to content

Commit

Permalink
expose lamellar_task to users + sync/send impls
Browse files Browse the repository at this point in the history
  • Loading branch information
rdfriese committed Dec 11, 2024
1 parent 70c3b4c commit e7b8d87
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/active_messaging/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ pub use crate::active_messaging::{
am, local_am, typed_am_group, ActiveMessaging, AmData, AmDist, AmGroupData, AmHandle,
AmLocalData, LamellarAM, LamellarSerde, RemoteActiveMessage, Serde,
};

pub use crate::async_trait;
// pub use crate::futures_util::StreamExt;
pub use crate::inventory;
pub use crate::lamellar_arch::*;
pub use crate::lamellar_team::LamellarTeam;
//#[doc(hidden)]
pub use crate::lamellar_team::IntoLamellarTeam;
pub use crate::lamellar_team::LamellarTeam;
pub use crate::lamellar_world::LamellarWorld;
pub use crate::lamellar_world::LamellarWorldBuilder;
pub use crate::scheduler::LamellarTask;
pub use crate::LamellarEnv;
pub use crate::LamellarTaskGroup;
pub use crate::{
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ pub use crate::lamellar_team::ArcLamellarTeam;
pub(crate) use crate::lamellar_team::LamellarTeamRT;
pub use crate::lamellar_world::*;
pub use crate::scheduler::ExecutorType;
pub use crate::scheduler::LamellarTask;

extern crate lamellar_impl;
// //#[doc(hidden)]
Expand Down
6 changes: 6 additions & 0 deletions src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ pub struct LamellarTask<T> {
executor: Arc<Executor>,
}

unsafe impl<T: Send> Send for LamellarTask<T> {}
unsafe impl<T: Sync> Sync for LamellarTask<T> {}

impl<T> LamellarTask<T> {
pub fn block(self) -> T {
RuntimeWarning::BlockingCall("LamellarTask::block", "<task>.await").print();
Expand All @@ -124,6 +127,9 @@ pub(crate) enum LamellarTaskInner<T> {
TokioTask(tokio::task::JoinHandle<T>),
}

unsafe impl<T: Send> Send for LamellarTaskInner<T> {}
unsafe impl<T: Sync> Sync for LamellarTaskInner<T> {}

impl<T> Drop for LamellarTaskInner<T> {
fn drop(self: &mut Self) {
// let mut dropped = LamellarTaskInner::Dropped;
Expand Down

0 comments on commit e7b8d87

Please sign in to comment.