Skip to content

Conversation

@larkliy
Copy link

@larkliy larkliy commented Apr 9, 2025

No description provided.

@m910q
Copy link
Contributor

m910q commented May 10, 2025

I tested it, but had some issues. Probably related to the Task implementation.
It works fine in debug, but not release builds. The following seems to have an infinite loop going:

        int[2] items = .(0, 1);
        Parallel.ForEach<int>(items, scope (item) => { });

Some other thoughts on the code:

  • If this goes into the corlib, it would be nice having it be available on non-Windows as well (Maybe use Platform.BfpSystem_GetNumLogicalCPUs()?)
  • tasks can use scope instead of new. task can use scope::

@bfiete
Copy link
Collaborator

bfiete commented May 10, 2025

I think it would be nice for someone to make a parallels library, but I'm not really thinking this is something that needs to go into corlib at the moment.

System.Threading.Tasks is uncooked and probably should be taken out of corlib as it stands, even...

@disarray2077
Copy link
Contributor

disarray2077 commented May 10, 2025

System.Threading.Tasks is uncooked and probably should be taken out of corlib as it stands, even...

Yeah, and to expand on that, I have also written a parallel class before, and IIRC the Task class has some thread race issues. For my project, I ended up just writing my own simple task class using WaitEvent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants