✅ do using the lock object in the below code make seance?
think this i real program that has users will prevent the other users to use _ aqurie in case of readin or writting
20 Replies
What do you mean by "the other users"?
i mean that if i have a user that is using the program on thread for writing and i have another client that use the same application and he wants to write to the same _acquire then this client will not be able to do so as the thread is locked , the only way that he could write on the _acquire is when the lock got relased
it doesn't make sense for this code to be using multiple threads at all, it all ends up running synchronously
likewise, because thread 1 and thread 2 cannot run at the same time in this code there is no point in using a lock
and if they were running at the same time, it would probably be more effective to copy the value of
_acquired
to a local instead of locking itwhat id i have a system that i don`t want the user to access specific resource like creating task as an example while other user is doing he same in that case i can use lock correct ?
should i pass the part of the multithread tell be advanced or i should learn it ,
i have leaned the basics of thread and threading and i think that's enough for my level correct and then i will learn about tasks
maybe? locks are only one of several synchronization options
if i were you i wouldn't spend so much time on contrived examples, work on real projects and learn C# as needed to complete those projects
i haven't needed to use the thread APIs in ages
I learned c# for making web applications and api so I think it's enough what I learned in c# and go to learn asp.net core
do you have full completed projects that make use of those skills?
No I just want to learn c# basics and then learn asp.net core
And make a web applications
i can tell you right now that if your goal is to learn ASP.NET Core then there is very little point learning threading this way right now
because you don't do threading like this in ASP.NET Core
it's much more heavily async/task based
Then I want to learn async and await and then go to asp.net core correct
if i were you i would go straight to some ASP.NET Core tutorials, and if you find something you don't understand then pause and learn that
learning a bunch of concepts without actually applying them to something isn't a particularly effective way to learn
Agree
This the link that contains all of the things that I have learned about c#https://prickly-collard-820.notion.site/C-Tutorial-b520663dc5884d8e8ba8cbe066cd0a67
It is written by me
Is that enough for asp.net core
it's probably close enough
you won't know until you actually try
I will start learning SQL server and asp net core
i suggest picking a project to make with ASP.NET Core and then figure out what you need to learn to make it work
I don't even have the basics of asp net core
I have a course that will teach me the basics with a project
But do I need to learn SQL server t-sql
I already know how to write SQL code because I know Laravel and I am using MySQL
what i'm saying is, just start a project
fill in the gaps as you go instead of trying to predict what you need to know first
Hem got the point I will
@Jimmacle thank you