Click here to Skip to main content
14,640,800 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: Crap on a cracker! Pin
#realJSOP21-Mar-20 8:25
mva#realJSOP21-Mar-20 8:25 
GeneralRIP Kenny Rogers Pin
Member 1477477021-Mar-20 2:15
MemberMember 1477477021-Mar-20 2:15 
GeneralRe: RIP Kenny Rogers Pin
Richard MacCutchan21-Mar-20 2:16
mveRichard MacCutchan21-Mar-20 2:16 
GeneralRe: RIP Kenny Rogers Pin
Mike Hankey21-Mar-20 2:41
professionalMike Hankey21-Mar-20 2:41 
GeneralRe: RIP Kenny Rogers Pin
DRHuff21-Mar-20 7:03
MemberDRHuff21-Mar-20 7:03 
RantI fear and loathe writing multithreaded code Pin
honey the codewitch21-Mar-20 1:40
mvahoney the codewitch21-Mar-20 1:40 
GeneralRe: I fear and loathe writing multithreaded code Pin
#realJSOP21-Mar-20 2:15
mva#realJSOP21-Mar-20 2:15 
GeneralRe: I fear and loathe writing multithreaded code Pin
honey the codewitch21-Mar-20 2:32
mvahoney the codewitch21-Mar-20 2:32 
In my MIDI project I just copy all the data I need to play a preview of it into a separate object. Then I take that separate object and I pass it to the thread creation function. That way I avoid having to use any synchronization primitives.

if (null != _previewThread)
{
	_previewThread.Abort();
	_previewThread.Join();
	_previewThread = null;
}
PreviewButton.Text = "Stop";
var f = _ProcessFile();
_previewThread = new Thread(() => { f.Preview(0,true); });
_previewThread.Start();


Here ProcessFile() does a number of operations on the midi file (not physically backed by a file - in memory but in the midi file format) passed in but what it gets back is always a copy, never the original.

The copy is then passed to the thread's creation function. That thread works on it, but other than that the copy is never touched again.
Real programmers use butterflies

GeneralRe: I fear and loathe writing multithreaded code Pin
Greg Utas21-Mar-20 2:46
professionalGreg Utas21-Mar-20 2:46 
GeneralRe: I fear and loathe writing multithreaded code Pin
honey the codewitch21-Mar-20 2:55
mvahoney the codewitch21-Mar-20 2:55 
GeneralRe: I fear and loathe writing multithreaded code Pin
Greg Utas21-Mar-20 3:13
professionalGreg Utas21-Mar-20 3:13 
GeneralRe: I fear and loathe writing multithreaded code Pin
Jörgen Andersson21-Mar-20 6:53
professionalJörgen Andersson21-Mar-20 6:53 
GeneralRe: I fear and loathe writing multithreaded code Pin
Greg Utas21-Mar-20 7:12
professionalGreg Utas21-Mar-20 7:12 
GeneralRe: I fear and loathe writing multithreaded code Pin
Member 798912221-Mar-20 12:04
MemberMember 798912221-Mar-20 12:04 
GeneralRe: I fear and loathe writing multithreaded code Pin
Greg Utas21-Mar-20 13:12
professionalGreg Utas21-Mar-20 13:12 
GeneralRe: I fear and loathe writing multithreaded code Pin
Rick York21-Mar-20 8:06
mveRick York21-Mar-20 8:06 
GeneralRe: I fear and loathe writing multithreaded code Pin
Member 798912221-Mar-20 9:39
MemberMember 798912221-Mar-20 9:39 
GeneralRe: I fear and loathe writing multithreaded code Pin
honey the codewitch21-Mar-20 10:34
mvahoney the codewitch21-Mar-20 10:34 
GeneralRe: I fear and loathe writing multithreaded code Pin
honey the codewitch21-Mar-20 10:38
mvahoney the codewitch21-Mar-20 10:38 
GeneralRe: I fear and loathe writing multithreaded code Pin
harold aptroot21-Mar-20 22:50
Memberharold aptroot21-Mar-20 22:50 
GeneralRe: I fear and loathe writing multithreaded code Pin
honey the codewitch22-Mar-20 4:07
mvahoney the codewitch22-Mar-20 4:07 
GeneralI suddenly got back into Espresso again. Pin
OriginalGriff21-Mar-20 0:46
mveOriginalGriff21-Mar-20 0:46 
GeneralRe: I suddenly got back into Espresso again. Pin
lopatir21-Mar-20 0:49
Memberlopatir21-Mar-20 0:49 
GeneralRe: I suddenly got back into Espresso again. Pin
glennPattonWork21-Mar-20 0:50
professionalglennPattonWork21-Mar-20 0:50 
GeneralRe: I suddenly got back into Espresso again. Pin
OriginalGriff21-Mar-20 0:54
mveOriginalGriff21-Mar-20 0:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.