Git Product home page Git Product logo

Comments (6)

buffalojoec avatar buffalojoec commented on August 21, 2024

Hey there, are you talking about right here?

impl<T> Token<T>
where
T: SendTransaction + SimulateTransaction,
{

And could you maybe elaborate on what the motivation would be to add this change? It's not immediately clear from the description.

Thanks!

from solana-program-library.

greged93 avatar greged93 commented on August 21, 2024

hey @buffalojoec, I was talking about the type below. From what I can see from the fields, it seems like the type was made in order to be Send + Sync? Otherwise why use Arc for client, payer,... ? I think we could make Token thread-safe by adding Send + Sync as a bounds for client, payer and nonce_authority.

pub struct Token<T> {
client: Arc<dyn ProgramClient<T>>,
pubkey: Pubkey, /* token mint */
decimals: Option<u8>,
payer: Arc<dyn Signer>,
program_id: Pubkey,
nonce_account: Option<Pubkey>,
nonce_authority: Option<Arc<dyn Signer>>,
nonce_blockhash: Option<Hash>,
memo: Arc<RwLock<Option<TokenMemo>>>,
transfer_hook_accounts: Option<Vec<AccountMeta>>,
}

from solana-program-library.

buffalojoec avatar buffalojoec commented on August 21, 2024

@greged93 Sorry I'm just getting back here!

Yeah I think making Token thread-safe makes sense. If you think it's important go for it!

from solana-program-library.

greged93 avatar greged93 commented on August 21, 2024

Great! Can you assign the issue?

from solana-program-library.

1500256797 avatar 1500256797 commented on August 21, 2024

Why can't we directly send Token between threads? I think this is necessary to fully utilize multithreading

from solana-program-library.

1500256797 avatar 1500256797 commented on August 21, 2024

If ProgramClient cannot be sent or synchronized directly between threads, how should it be handled in concurrent scenarios? I believe it needs to be implemented with the Send and Sync traits to address multithreading concurrency issues.

from solana-program-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.