Search found 377 matches

by Provoni
Feb 01, 2014 22:02
Forum: Beginners
Topic: Threading questions/problems
Replies: 80
Views: 28486

Re: Threading questions

Thanks MichaelW. I've run into some problems with the threading in one of my programs. I'm trying to thread a sub which is responsible for drawing stuff on the screen with line and draw string. I made sure to put all shared variables inside a mutex. Screenlock and unlock seem not to work as intended...
by Provoni
Jan 30, 2014 7:36
Forum: Beginners
Topic: Threading questions/problems
Replies: 80
Views: 28486

Re: Threading questions

Thanks all :) vdecampo, what is PUSH/POP the stack? Yes, your version is more than twice as fast, I guess, mainly because you moved two subs into one? And what do you mean by large overhead? Thanks fxm for your example, I'm still thinking if I will use ptr's or shared variable's. I need to do some t...
by Provoni
Jan 29, 2014 10:02
Forum: Beginners
Topic: Threading questions/problems
Replies: 80
Views: 28486

Re: Threading questions

Hey all, This continues to baffle me, I commented out the mutexes just to test and while the counter in my array only counts to 7000000 out of 10000000 somehow it manages to come up with 100% of the integers correctly prime checked. Thread lightly? :) declare sub MYTHREAD(info as any ptr) declare fu...
by Provoni
Jan 29, 2014 9:22
Forum: Beginners
Topic: Threading questions/problems
Replies: 80
Views: 28486

Re: Threading questions

This is what I did: fs, test and array() are shared variables, so I moved them in the mutex. My progam is now benefiting from threading once again. Does it look good? sub MYTHREAD(info as any ptr) 'works itself tru the array without overlapping other threads dim as longint i,una dim as byte b mutexl...
by Provoni
Jan 29, 2014 9:05
Forum: Beginners
Topic: Threading questions/problems
Replies: 80
Views: 28486

Re: Threading questions

Hey SARG, I didn't realize that, so my above program is flawed because it's accessing the same array, and I did some testing to confirm that. If I use the mutex my program is not faster than without threading. I found this in the wiki: If there is a global variable used by multiple threads (or a loc...
by Provoni
Jan 29, 2014 7:44
Forum: Beginners
Topic: Threading questions/problems
Replies: 80
Views: 28486

Re: Threading questions

Hey all, I learned that it is better, speed-wise, to assign a bunch of work to one thread instead of lots of small parts, threadwait seems to be slow. I now feel more than confident that I can add threading support to my other programs. Here's my example program open for discussion, I know how to pa...
by Provoni
Jan 28, 2014 9:07
Forum: Beginners
Topic: Threading questions/problems
Replies: 80
Views: 28486

Re: Threading questions

Thanks SARG, that works.

Now I understand why vdecampo used the arrow. :)

http://www.freebasic.net/wiki/wikka.php ... PgPointers
by Provoni
Jan 28, 2014 7:45
Forum: Beginners
Topic: Threading questions/problems
Replies: 80
Views: 28486

Re: Threading questions

Thanks vdecampo, I'm just starting to learn about pointers, I modified your example trying to cast it to a longint variable instead but no succes; supicious pointer assignment is given as error. declare sub mythread(m_data as any ptr) dim mine as longint threadcreate(@mythread,@mine) sleep print min...
by Provoni
Jan 27, 2014 10:58
Forum: Beginners
Topic: Threading questions/problems
Replies: 80
Views: 28486

Threading questions/problems

Hey all, I created a little threaded prime number checker using the wiki threading examples. I'm putting it up for review, not the logic of the checker itself but everything else. It takes 3.7 seconds to finish on my i5, just warning those with a slow PC. Besides that I also have some questions. @ht...
by Provoni
Jan 26, 2014 15:18
Forum: Beginners
Topic: FBIde running slow
Replies: 0
Views: 448

FBIde running slow

Hey all,

FBIde is starting to run slow on my i5, any recommendations? My program has just reached 2500 lines. I also noticed it refreshes the subs, functions, etc tree view for every keystroke I do.

Thanks
by Provoni
Jan 26, 2014 12:55
Forum: Beginners
Topic: #include bug?(no bug, solved)
Replies: 4
Views: 604

Re: #include bug?

I'm sorry to have wasted your time but it happened because I didn't resave the .bas I included after some changes. :)
by Provoni
Jan 26, 2014 9:28
Forum: Beginners
Topic: #include bug?(no bug, solved)
Replies: 4
Views: 604

#include bug?(no bug, solved)

Hey all, It's the first time I decided to use #include for some data I didn't want to clutter up my program with. The data is stored in a type variable array. Crude example: sub DATA array(1,1).s="abc" array(1,1).a=123 array(100,1).s="new" array(100,1).a=321 end sub I then replac...
by Provoni
Jan 22, 2014 17:04
Forum: Beginners
Topic: Single RGB color value possible?(solved)
Replies: 3
Views: 941

Re: Single RGB color value possible?

Thanks gothon, I don't like working with hex. By testing I found out I can simply do this! (see code) I need to be able to use the modulo operator. Just curious if this might produce problems with transparency, I'm not using transparency in my program and I probably don't need it anyway. But it's go...
by Provoni
Jan 21, 2014 21:31
Forum: Beginners
Topic: Array questions(solved)
Replies: 14
Views: 1823

Re: Array questions

Thanks gothon and fxm!
by Provoni
Jan 21, 2014 21:25
Forum: Beginners
Topic: Single RGB color value possible?(solved)
Replies: 3
Views: 941

Single RGB color value possible?(solved)

Hey all,

Is it somehow possible to use a single value to increment an rgb color value?

256 ^ 3 = 16777216.

Instead of something like this?

Code: Select all

'pseudo code
for r=0 to 255
for g=0 to 255
for b=0 to 255
color rgb(r,g,b)
next b,g,r


Thanks

Go to advanced search