Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Inf3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcel Kehrberg
Inf3
Commits
110a841b
Commit
110a841b
authored
2 years ago
by
Michael Ghebremussie
Browse files
Options
Downloads
Patches
Plain Diff
Added Exception for the Queue
parent
c429c1eb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Aufgabe3/ConsoleApplication1/Buffer.cs
+17
-2
17 additions, 2 deletions
Aufgabe3/ConsoleApplication1/Buffer.cs
Aufgabe3/ConsoleApplication1/obj/Debug/ConsoleApplication1.csproj.AssemblyReference.cache
+0
-0
0 additions, 0 deletions
.../Debug/ConsoleApplication1.csproj.AssemblyReference.cache
with
17 additions
and
2 deletions
Aufgabe3/ConsoleApplication1/Buffer.cs
+
17
−
2
View file @
110a841b
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Diagnostics
;
using
System.Runtime.InteropServices
;
using
System.Runtime.Serialization
;
using
System.Threading
;
using
System.Threading
;
namespace
ConsoleApplication1
namespace
ConsoleApplication1
...
@@ -25,7 +27,7 @@ namespace ConsoleApplication1
...
@@ -25,7 +27,7 @@ namespace ConsoleApplication1
// Check whether the Queue is full and throws an Exception if so.
// Check whether the Queue is full and throws an Exception if so.
if
(
_carQueue
.
Count
==
_size
)
if
(
_carQueue
.
Count
==
_size
)
{
{
throw
new
Exception
(
"Buffer full"
);
throw
new
QueueFull
Exception
(
"Buffer full"
);
}
}
_carQueue
.
Enqueue
(
c
);
_carQueue
.
Enqueue
(
c
);
...
@@ -36,7 +38,7 @@ namespace ConsoleApplication1
...
@@ -36,7 +38,7 @@ namespace ConsoleApplication1
{
{
if
(
_carQueue
.
Count
==
0
)
if
(
_carQueue
.
Count
==
0
)
{
{
throw
new
Exception
(
"Buffer empty"
);
throw
new
QueueEmpty
Exception
(
"Buffer empty"
);
}
}
return
_carQueue
.
Dequeue
();
return
_carQueue
.
Dequeue
();
...
@@ -60,4 +62,17 @@ namespace ConsoleApplication1
...
@@ -60,4 +62,17 @@ namespace ConsoleApplication1
return
this
.
_mutex
;
return
this
.
_mutex
;
}
}
}
}
}
public
class
QueueEmptyException
:
Exception
{
public
QueueEmptyException
(
string
bufferEmpty
)
:
base
(
bufferEmpty
)
{
}
}
public
class
QueueFullException
:
Exception
{
public
QueueFullException
(
string
bufferEmpty
)
:
base
(
bufferEmpty
)
{
}
}
}
This diff is collapsed.
Click to expand it.
Aufgabe3/ConsoleApplication1/obj/Debug/ConsoleApplication1.csproj.AssemblyReference.cache
+
0
−
0
View file @
110a841b
No preview for this file type
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment