You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As mentioned in commit f059129 (Make memory/cpu static members of console), we should figure out the proper way to share components of the emulator between the different components that interact.
Coming from a C++/C# background, we are familiar with singletons/static classes (respectively), but from what i was reading here, in D, local and static variables exist on a per-thread basis. This means if we simply create a static class, each thread will have a copy of the Console object, and a separate CPU/Memory object, since those are allocated in the console.
We have two options, and I want to hear your opinions, @bobomb:
Use the singleton pattern, alá C++ (private ctor, private shared instanceRef, public static getReference() method, manual thread locking for each object)
Use a shared static class. This will be initialized before main() is even called. All Console members will need to be marked shared static, but this might handle any threading issues that might arise.
(I still believe we should implement the different processors of the NES in different threads; even though we could just time-slice, I feel this will be more akin to how the real NES operated, and we can let each thread implement its own timing)
The text was updated successfully, but these errors were encountered:
As mentioned in commit f059129 (Make memory/cpu static members of console), we should figure out the proper way to share components of the emulator between the different components that interact.
Coming from a C++/C# background, we are familiar with singletons/static classes (respectively), but from what i was reading here, in D, local and static variables exist on a per-thread basis. This means if we simply create a static class, each thread will have a copy of the Console object, and a separate CPU/Memory object, since those are allocated in the console.
We have two options, and I want to hear your opinions, @bobomb:
private ctor
,private shared instanceRef
,public static getReference()
method, manual thread locking for each object)shared static
class. This will be initialized beforemain()
is even called. All Console members will need to be markedshared static
, but this might handle any threading issues that might arise.(I still believe we should implement the different processors of the NES in different threads; even though we could just time-slice, I feel this will be more akin to how the real NES operated, and we can let each thread implement its own timing)
The text was updated successfully, but these errors were encountered: