An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
C# How to create thread based pipe line
T.Zacks
3,996
Reputation points
I was searching google to create a thread based pipe line and i found the below incomplete code. please see the code and please discuss how it would be working ?
the code is incomplete. so it will be great help if any one create a sample scenario with the below incomplete code.
public class OnFetchEvent : AsyncEvent {}
public class OnDecodeEvent : AsyncEvent {}
public class OnExecuteEvent : AsyncEvent {}
public class OnWritebackEvent : AsyncEvent {}
public class FetchObserver : Observer,
IObserve<OnFetchEvent>
{
public void OnEvent(OnFetchEvent @event)
{
....do some stuff
// raise the next event
RaiseEvent<OnDecodeEvent>();
}
}
public class Pipeline
{
public void RaiseEvent<TEvent>()
{
if (typeof(TEvent) is AsyncEvent)
...create thread and raise the event which will notify the appropriate
observers of the event in the newly created thread
}
}
Usage:
pipeline.RegisterObserver<FetchObserver>()
.AndObserver<DecodeObserver>()
.AndObserver<ExecuteObserver>()
.AndObserver<WriteBackObserver>();
pipeline.RaiseEvent<OnFetchEvent>();
at all the above code has any relation with thread ?. with my small understanding it seems it is event based with Observer. please some one create a sample example with above code.
Thanks
Developer technologies | C#
Developer technologies | C#
Sign in to answer