Search found 58 matches

by SamL
Jul 17, 2020 16:27
Forum: Beginners
Topic: is OPEN, Get and Put # (File I/O) thread safe?
Replies: 8
Views: 1502

Re: is OPEN, Get and Put # (File I/O) thread safe?

I learned that using freefile() only works in one thread at a time unless put a mutexlock around freefile() and OPEN. freefile() checks how many files are open before returning a value. so there is a window of time that freefile() could return the same number if making multiple requests for a file n...
by SamL
Jul 17, 2020 16:08
Forum: Beginners
Topic: is OPEN, Get and Put # (File I/O) thread safe?
Replies: 8
Views: 1502

Re: is OPEN, Get and Put # (File I/O) thread safe?

I only mutexlock for the file number , and Im not using freefile() Here is the code I used to test. ( I updated the code as I found a few mistakes.. ) NOTE: there is updated code for this test below that uses random strings for testing that will detect issues faster/better than this test. 'press ESC...
by SamL
Jul 17, 2020 15:29
Forum: Beginners
Topic: is OPEN, Get and Put # (File I/O) thread safe?
Replies: 8
Views: 1502

Re: is OPEN, Get and Put # (File I/O) thread safe?

ok, thanks for the help! My testing of multi-thread with OPEN, GET and PUT resulted in no issues with multi-threading. The very very rare crash I was hunting down turned out to be Windows 10 resetting the computer for updates and this caused some files to have unexpected data written to them. Appare...
by SamL
Jul 16, 2020 2:30
Forum: Beginners
Topic: is OPEN, Get and Put # (File I/O) thread safe?
Replies: 8
Views: 1502

is OPEN, Get and Put # (File I/O) thread safe?

I open different files using a custom file number function that's mutexed. I am opening the same files sometimes from different threads but all those files are always mutexed. but when opening different files in different threads im thinking there might be an issue with the OPEN / GET / PUT commands...
by SamL
Jul 11, 2020 18:13
Forum: Beginners
Topic: Need help with passing a parameter
Replies: 5
Views: 1507

Re: Need help with passing a parameter

Can a Function return more than one value? If so how do you do it? yes!! by using a type. here are some ways to do that! type test as long number_1 as long number_2 end type function example1 (param as long ) as test dim my_udt as test my_udt.number_1 = param my_udt.number_2 = param*2 return my_udt...
by SamL
Jul 11, 2020 17:35
Forum: Beginners
Topic: Odd pause when sometimes starting programme
Replies: 3
Views: 932

Re: Odd pause when sometimes starting programme

i get the same thing some times. with my code. i have also disabled my windows defender scanning that directory but i still get the pause when compiling and run the program sometimes. mostly only happens the first time i compile run it. and there is a pause for around 2 seconds or so while the progr...
by SamL
Jul 11, 2020 17:22
Forum: Beginners
Topic: Q. dim array(any) vs redim array(1 to 1) (SOLVED!!)
Replies: 2
Views: 741

Q. dim array(any) vs redim array(1 to 1) (SOLVED!!)

I have a sub i call and set up a string array. then I REDIM the array in a loop based on a file size and load different files using the same array. is it better to use "dim as string array(any) " or "Redim as string array(1 to 1)" ?? what example is correct? or are both ok to use...
by SamL
Apr 23, 2020 3:05
Forum: General
Topic: weird error, Opening file with same name on different hard drive in windows 10.
Replies: 5
Views: 762

Re: weird error, Opening file with same name on different hard drive in windows 10.

Great! there some new stuff in there for me to look at and use such as how the file is copied to memory. this helps me!. I was going to post my file number function but i was not able to for a while so here it is. dim shared as ubyte freefile_numbers(1 to 255) dim shared as string*100 freefile_owner...
by SamL
Apr 22, 2020 19:04
Forum: General
Topic: weird error, Opening file with same name on different hard drive in windows 10.
Replies: 5
Views: 762

Re: weird error, Opening file with same name on different hard drive in windows 10.

Thanks for the replies, I'm using Windows 10 x64, Workstation edition. Ryzen 7 2700, 32GB ram. OS is on a ssd nvme m.2, but setting files being opened are on a HDD with sata. My biggest concern is an OS issue but it must be a code issue, Its just odd because I have been running this code for a while...
by SamL
Apr 22, 2020 14:52
Forum: General
Topic: weird error, Opening file with same name on different hard drive in windows 10.
Replies: 5
Views: 762

weird error, Opening file with same name on different hard drive in windows 10.

I'm using Windows 10, workstation edition. I had a strange thing happen, I'm wondering if anyone else had this issue before. please note, I have been using this code for some time with out issue and never had this happen before. I have files that hold settings for loading data into a program. I have...
by SamL
Jan 07, 2020 23:54
Forum: General
Topic: Mutexlock inside or outside function calls?
Replies: 3
Views: 746

Re: Mutexlock inside or outside function calls?

Thanks for the help paul. :)
by SamL
Nov 23, 2019 18:02
Forum: General
Topic: Mutexlock inside or outside function calls?
Replies: 3
Views: 746

Mutexlock inside or outside function calls?

Hello every one! thanks to every one posting great info on the forums for freebasic!! I'm working with threads and i have a question regarding using functions with more then one thread. here are my explanation examples: example 1, ( what i would like to do. ) function myfunc( param_1 ) MutexLock myf...