![]() I really want to learn as much as I can in C before using C++, but I read C++ libraries from a time to time and I know some of the methods that C++ use. I tried to find a better way in the first time, but I found that void pointers are the only solution in C, because I think that I can do almost but not entirely anything with C. I'd highly recommend designing some sort of type erasure abstraction to manage different argument types and counts. ![]() ![]() Yes, this was the only way I could achieve this code using void pointers because it allows me to pass whatever arguments type I want with casting everything. Void pointers are a cancer that spread through your code base, Yes, it's a "cooperative multitasking", but with a feature of grouping multiple tasks to a certain thread and monitor that thread in the manager function.It has one thread as an example, I can put another thread with its tasks.In this case, I think “cooperative multitasking” would be a more suitable name than “multithreading”. Is this true multithreading with context switching where tasks can yield and resume later, or where the runtime can preempt running tasks? At first sight, your code has only one thread of execution, and all functions run to completion. What you suggest for me ? I signed the issue part with an arrow. I did some parts in this function but the problem is the same in the one using void pointers. if number of tasks is finished, set coroutine state as done the problem here, which is how to process different functions I'm not using any delays in my current codes.īoth are working, here is how I mange the one with void pointers: void run_thread(THREAD *thrd, TASK *tsk)
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |