Re: [go-nuts] Question on handling Data Race

2021-09-11 Thread Michael Dwyer
lem sufficiently? Have I missed any potential edge cases, that I have not thought through? I look forward to your reply. Thank you for your time and patience ... THANX(MKD). On Saturday, September 11, 2021 at 8:42:36 PM UTC-4 Kurtis Rader wrote: > On Sat, Sep 11, 2021 at 5:01 PM Michael

[go-nuts] Question on handling Data Race

2021-09-11 Thread Michael Dwyer
Presently working on a Data Race and have some questions on how to proceed. The code example is a hypothetical mock up of the actual code under review, but is a fair representation. The struct used by both functions is named Foo. In the hypothetical, SomeFunc() reads variable from foo.bar, checki

Re: [go-nuts] Two consecutive reads from a buffered channel results in deadlock

2021-09-04 Thread Michael Dwyer
helpful hints and documentation, so others can learn. Greatly appreciate your time an assistance. THANX(MKD). On Saturday, September 4, 2021 at 9:31:32 PM UTC-4 Kurtis Rader wrote: > On Sat, Sep 4, 2021 at 5:55 PM Michael Dwyer wrote: > >> I encountered a deadlock when reading fro

[go-nuts] Two consecutive reads from a buffered channel results in deadlock

2021-09-04 Thread Michael Dwyer
I encountered a deadlock when reading from a buffered channel. The deadlock occurs when an attempt is made to read from the channel twice, without an intermediate write to the channel. The problematic code is as follows: func main() { myInt := 432 readerChan := make(chan int, 3) for forI

[go-nuts] Re: Problems refactoring call to Open()

2017-06-21 Thread Michael Dwyer
Peter, with your responses I was able to figure out the cause of the error. I created a function that calls defer. I did it as a function as I put some trace code in along with the Close(). >From that I concluded you were correct. I went ahead and reworked the rest of the code, which was my inte

[go-nuts] Re: Problems refactoring call to Open()

2017-06-21 Thread Michael Dwyer
Peter, Thank you for helping me out. I'm going to be busy the next couple of days. When I have some free time I will go over your replies. Seems that my analysis was inadequate. I do appreciate the points you made. Gives me an opportunity to try some different code tweaks. When I am able I will

[go-nuts] Re: Problems refactoring call to Open()

2017-06-21 Thread Michael Dwyer
Peter, Thank you for your input regarding my question. In an effort to clear up any confusion or ambiguity regarding the problem I am running into, I will post the code for what is working and the code that is not working. The following block of code works, a valid file is passed to the execut

[go-nuts] Problems refactoring call to Open()

2017-06-21 Thread Michael Dwyer
Hello to all, My first time posting questions here, so please bear with me, I'm willing to learn. I have a simple piece of code, which opens a file, reads the contents and counts the number of lines in the file. What I am attempting to do is to refactor the code. The error occurs when I read t